watson.db.commands¶
-
class
watson.db.commands.
Database
(config)[source]¶ Database commands.
-
generate_fixtures
(models, output_to_stdout)[source]¶ Generate fixture data in json format.
Parameters: - models (string) – A comma separated list of models to output
- output_to_stdout (boolean) – Whether or not to output to the stdout
-
generate_models
(connection_string=None, tables=None, outfile=None)[source]¶ Generate models from an existing database schema.
Parameters: - connection_string (string) – The database to connect to
- tables (string) – Tables to process (comma-separated, default: all)
- outfile (string) – File to write output to (default: stdout)
-
-
class
watson.db.commands.
Migrate
(config)[source]¶ Alembic integration with Watson.
-
history
(rev_range)[source]¶ List changeset scripts in chronological order.
Parameters: rev_range – Revision range in format [start]:[end]
-
revision
(sql=False, autogenerate=False, message=None)[source]¶ Create a new revision file.
Parameters: - sql (bool) – Don’t emit SQL to database - dump to standard output instead
- autogenerate (bool) – Populate revision script with andidate migration operatons, based on comparison of database to model
- message (string) – Message string to use with ‘revision’
-
stamp
(sql=False, tag=None, revision='head')[source]¶ ‘stamp’ the revision table with the given revision; don’t run any migrations.
Parameters: - sql (bool) – Don’t emit SQL to database - dump to standard output instead
- tag (string) – Arbitrary ‘tag’ name - can be used by custom env.py scripts
- revision (string) – Revision identifier
-