sqlobject.manager.command module¶
-
class
sqlobject.manager.command.
Command
(invoked_as, command_name, args, runner)[source]¶ Bases:
object
-
aliases
= ()¶
-
description
= None¶
-
help
= ''¶
-
max_args
= 0¶
-
max_args_error
= 'You must provide no more than %(max_args)s arguments'¶
-
min_args
= 0¶
-
min_args_error
= 'You must provide at least %(min_args)s arguments'¶
-
open_editor
(pretext, breaker=None, extension='.txt')[source]¶ Open an editor with the given text. Return the new text, or None if no edits were made. If given, everything after breaker will be ignored.
-
orderClassesByDependencyLevel
(classes)[source]¶ Return classes ordered by their depth in the class dependency tree (this is not the inheritance tree), from the top level (independant) classes to the deepest level. The dependency tree is defined by the foreign key relations.
-
prog_name
¶
-
required_args
= []¶
-
-
class
sqlobject.manager.command.
CommandCreate
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
name
= 'create'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Create tables'¶
-
-
class
sqlobject.manager.command.
CommandDrop
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
name
= 'drop'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Drop tables'¶
-
-
class
sqlobject.manager.command.
CommandExecute
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
help
= 'Runs SQL statements directly in the database, with no intervention. Useful when used with a configuration file. Each argument is executed as an individual statement.'¶
-
max_args
= None¶
-
name
= 'execute'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Execute SQL statements'¶
-
-
class
sqlobject.manager.command.
CommandHelp
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
max_args
= 1¶
-
name
= 'help'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Show help'¶
-
-
class
sqlobject.manager.command.
CommandList
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
name
= 'list'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Show all SQLObject classes found'¶
-
-
class
sqlobject.manager.command.
CommandRecord
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
help
= 'Record state of table definitions. The state of each table is written out to a separate file in a directory, and that directory forms a "version". A table is also added to your database (sqlobject_db_version) that reflects the version the database is currently at. Use the upgrade command to sync databases with code.'¶
-
name
= 'record'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Record historical information about the database status'¶
-
version_regex
= <_sre.SRE_Pattern object>¶
-
-
class
sqlobject.manager.command.
CommandSQL
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
name
= 'sql'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Show SQL CREATE statements'¶
-
-
class
sqlobject.manager.command.
CommandStatus
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.Command
-
help
= 'This command checks the SQLObject definition and checks if the tables in the database match. It can always test for missing tables, and on some databases can test for the existance of other tables. Column types are not currently checked.'¶
-
name
= 'status'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Show status of classes vs. database'¶
-
-
class
sqlobject.manager.command.
CommandUpgrade
(invoked_as, command_name, args, runner)[source]¶ Bases:
sqlobject.manager.command.CommandRecord
-
help
= 'This command runs scripts (that you write by hand) to upgrade a database. The database\'s current version is in the sqlobject_version table (use record --force-db-version if a database does not have a sqlobject_version table), and upgrade scripts are in the version directory you are upgrading FROM, named upgrade_DBNAME_VERSION.sql, like "upgrade_mysql_2004-12-01b.sql".'¶
-
name
= 'upgrade'¶
-
parser
= <optparse.OptionParser instance>¶
-
summary
= 'Update the database to a new version (as created by record)'¶
-
upgrade_regex
= <_sre.SRE_Pattern object>¶
-
-
class
sqlobject.manager.command.
SQLObjectVersionTable
(**kw)[source]¶ Bases:
sqlobject.main.SQLObject
This table is used to store information about the database and its version (used with record and update commands).
-
j
= sqlobject_db_version¶
-
q
= sqlobject_db_version¶
-
class
sqlmeta
(instance)¶ Bases:
sqlobject.main.sqlmeta
-
childName
= None¶
-
idName
= 'id'¶
-
indexes
= []¶
-
joinDefinitions
= []¶
-
joins
= []¶
-
soClass
¶
-
style
= <sqlobject.styles.MixedCaseUnderscoreStyle object>¶
-
table
= 'sqlobject_db_version'¶
-
-
updated
¶
-
version
¶
-
-
sqlobject.manager.command.
db_differences
(soClass, conn)[source]¶ Returns the differences between a class and the table in a connection. Returns [] if no differences are found. This function does the best it can; it can miss many differences.