How are the sql* commands meant to be used? They just output sql, so is there an elegant way to pass it to mysql? ./manage.py sqlindexes [app] gives me the mysql code - do I just note it down and then type it in? (edit: erm...copy and paste for others. heh.)
Pardon my ignorance, and please let me know if there's a completely different but better way of using it.
Pipe it to the dbshell command like so:
python manage.py sqlindexes my_app | python manage.py dbshell
Related
I need to test the model described in the IceNet paper but I am having issues making the Mamba environment.
After installing Mamba as described here, if I run the command mamba env create --name esports --file environment.yml I get the error The following arguments were not expected: environment.yml --file create Run with --help for more information.
Is there a way I can fix that? Also, I am working with an A100 GPU. Does it still make sense to use Mamba (the code was originally developed to run on a laptop) or am I already fine using Conda as usual?
Mamba should have the same API a Conda so the command yo tried should be correct. The error you get is likely due to a typo.
Note that I was able to trigger this exact error using Micromamba which has a different API than Mamba. Micromamba only has the micromamba create command that handles both YAML and list environment files. In that case, the correct command is:
micromamba create --name esports --file environment.yml
I have searched through related questions but have still not found an answer to this one.
I am using Wordmove to try and push/pull databases between local and live environments for WordPress (running on AMPPS on OSX). I have come back to trying the Wordmove method since the fork of WP-Sync-DB stopped working for me and appears to be abandoned now. This was the best free method for migrating databases between WordPress environments.
The error I am getting when running wordmove pull -e runcloud --db is sh: mysqldump: command not found
I am using Zsh and have already added a symlink to the only mysqldump I could locate on my system: alias mysqldump='/Applications/AMPPS/mysql/bin/mysqldump --host=localhost -uroot -proot' in .zprofile . It is also included in my .bash_profile . Without that line I simply get mysqldump not found (verified by commenting the line and needing to restart iTerm after each change).
So now if I type which mysqldump I get mysqldump: aliased to /Applications/AMPPS/mysql/bin/mysqldump --host=localhost -uroot -proot
But the error from Wordmove persists. I have enquired on the Wordmove Github and the author says this will be an error with how mysqldump if configured.
Disclaimer: I am not at all expert with CLI, only knowing enough to configure an environment for Gulp, using tools like Wordmove and basic stuff over SSH. I chose Zsh as it made a lot of stuff easier to use and to see, but any kind of configuration for this usually has me scratching my head!
Have I missed something obvious here? Perhaps the symlink is not set up correctly?
I see two conceptual problems here:
(1) You can not export an alias. An alias defined in the current Zsh, won't be automtaically be visible in a child Zsh.
(2) Your error message says
sh: mysqldump: command not found
which means that Zsh is not even involved when looking for mysqldump. This is a Posix shell script running.
Hence, every mechanism you want to use must work with Posix shell, which means that you need a program (a suitable shell script) named mysqldump in your PATH, which then calls the original mysqldump with the parameters you have in mind.
Make sure that the PATH is set up so that your private version of mysqldump is found before the one in /Applications/AMPPS/mysql/bin.
I'm trying to export my SQLite data and then import into MySQL (after making the appropriate changes to the settings.py file). Here is the error I see when trying to import the data:
python manage.py loaddata < datadump.json
CommandError: No database fixture specified. Please provide the path of at least one fixture in the command line.
Any ideas on what the problem could be?
Remove the '<'
python manage.py loaddata datadump.json
To import a large JSON dataset in MongoDB we have mongoimport utility which works like that:
mongoimport --host xxx.xxx.xxx.xxx --db destination-db -c tags < tmp/source-file.json
Is there a way to call 'mongoimport' using MongoID, the ruby Object-Document-Mapper for MongoDB ?
Thanks
Luca
Mongoid is effectively a wrapper around the Ruby driver. The Ruby driver should allow you to run any of the database commands.
However, mongoimport is not a command. mongoimport is a separate binary (or executable) file.
The only way to run mongoimport from Ruby is to "shell out". Typically this involves using some form of exec command. Here's the first search link for running shell commands from Ruby.
You can also parse the JSON from your file, and just run Model.create(json_obj) and Mode.save directly in a rake task.
I am new to django and python in general, so pardon me for any simple mistakes I may be doing. I am trying to setup my first django project on my local windows vista machine. I have created the project successfully with no problems. The issue I am coming across is when my settings.py has values for my database keys, the manage.py runserver command is failing. If I have values in settings before I run the command, as soon as I run it I get errors. If I have already run the command and the server is running, as soon as I edit the settings file with values, the errors show up in my still open command prompt. The inner most exception seems to "Error loading MySQLdb module: No module named MYSQLdb". If I leave the settings.py blank, the command executes with no problems.
Any advice would be greatly appreciated!
Thanks
You don't have mysql-python module installed, thats why you getting that error.
You could find that module at
http://pypi.python.org/pypi/MySQL-python/
Install the MySQLdb module, or the oursql module along with the django-oursql connector.