sqlobject.manager.command module — SQLObject 3.9.1 documentation

# sqlobject.manager.command module

class `sqlobject.manager.command.` `Command`(invoked_as, command_name, args, runner)

  Bases: `object`

  `aliases` = ()
  `ask`(prompt, safe=False, default=True)
  `classes`(require_connection=True, require_some=False)
  `classes_from_egg`(egg_spec)
  `classes_from_module`(module)
  `classes_from_package`(package_name)
  `command`()
  `config`()
  `config_from_egg`(egg_spec, warn_no_sqlobject=True)
  `connection`()
  `description` = None
  `help` = ''
  `ini_config`(conf_fn)
  `load_options_from_egg`(egg_spec)
  `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')

    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)

    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.

  property `prog_name`
  `required_args` = []
  `run`()
  `shorten_filename`(fn)

    Shortens a filename to make it relative to the current directory (if it can). For display purposes.

class `sqlobject.manager.command.` `CommandCreate`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.Command`

  `command`()
  `name` = 'create'
  `parser` = <optparse.OptionParser object>
  `summary` = 'Create tables'

class `sqlobject.manager.command.` `CommandDrop`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.Command`

  `command`()
  `name` = 'drop'
  `parser` = <optparse.OptionParser object>
  `summary` = 'Drop tables'

class `sqlobject.manager.command.` `CommandExecute`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.Command`

  `command`()
  `execute_sql`(sql)
  `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 object>
  `summary` = 'Execute SQL statements'

class `sqlobject.manager.command.` `CommandHelp`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.Command`

  `command`()
  `max_args` = 1
  `name` = 'help'
  `parser` = <optparse.OptionParser object>
  `summary` = 'Show help'

class `sqlobject.manager.command.` `CommandList`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.Command`

  `command`()
  `name` = 'list'
  `parser` = <optparse.OptionParser object>
  `summary` = 'Show all SQLObject classes found'

class `sqlobject.manager.command.` `CommandRecord`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.Command`

  `base_dir`()
  `command`()
  `command_force_db_version`()
  `find_last_version`()
  `find_output_dir`()
  `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 object>
  `strip_comments`(sql)
  `summary` = 'Record historical information about the database status'
  `update_db`(version, conn)
  `version_regex` = re.compile('^\\d\\d\\d\\d-\\d\\d-\\d\\d')

class `sqlobject.manager.command.` `CommandRunner`

  Bases: `object`

  `invalid`(msg, code=2)
  `register`(command)
  `run`(argv)

class `sqlobject.manager.command.` `CommandSQL`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.Command`

  `command`()
  `name` = 'sql'
  `parser` = <optparse.OptionParser object>
  `summary` = 'Show SQL CREATE statements'

class `sqlobject.manager.command.` `CommandStatus`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.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 object>
  `print_class`(soClass)
  `summary` = 'Show status of classes vs. database'

class `sqlobject.manager.command.` `CommandUpgrade`(invoked_as, command_name, args, runner)

  Bases: `sqlobject.manager.command.CommandRecord`

  `best_upgrade`(current, dest, target_dbname)
  `command`()
  `current_version`()
  `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".'
  `make_plan`(current, dest)
  `name` = 'upgrade'
  `parser` = <optparse.OptionParser object>
  `summary` = 'Update the database to a new version (as created by record)'
  `upgrade_regex` = re.compile('^upgrade_([a-z]*)_([^.]*)\\.sql$', re.IGNORECASE)

class `sqlobject.manager.command.` `SQLObjectVersionTable`(**kw)

  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`

      alias of `sqlobject.manager.command.SQLObjectVersionTable`

    `style` = <sqlobject.styles.MixedCaseUnderscoreStyle object>
    `table` = 'sqlobject_db_version'
  property `updated`
  property `version`

`sqlobject.manager.command.` `db_differences`(soClass, conn)

  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.

`sqlobject.manager.command.` `nowarning_tempnam`(*args, **kw)

`sqlobject.manager.command.` `register`(command)

`sqlobject.manager.command.` `standard_parser`(connection=True, simulate=True, interactive=False, find_modules=True)

`sqlobject.manager.command.` `update_sys_path`(paths, verbose)