flexget.db_schema module#
- exception flexget.db_schema.UpgradeImpossible[source]#
Bases:
ExceptionException to be thrown during a db upgrade function which will cause the old tables to be removed and recreated from the new model.
- class flexget.db_schema.FlexgetVersion[source]#
Bases:
Base- _sa_class_manager = {'created': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'version': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- created#
- version#
- class flexget.db_schema.PluginSchema(plugin, version=0)[source]#
Bases:
Base- _sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'plugin': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'version': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}#
- id#
- plugin#
- version#
- class flexget.db_schema.VersionedBaseMeta(metaname, bases, dict_)[source]#
Bases:
DeclarativeMetaMetaclass for objects returned by versioned_base factory.
- flexget.db_schema.after_table_create(target, connection, tables=None, **kw)[source]#
Set the schema version to most recent for a plugin when it’s tables are freshly created.
- Parameters:
tables (list[Table] | None)
- Return type:
None
- flexget.db_schema.upgrade(plugin)[source]#
Use as a decorator to register a schema upgrade function.
The wrapped function will be passed the current schema version and a session object. The function should return the new version of the schema after the upgrade.
There is no need to commit the session, it will commit automatically if an upgraded schema version is returned.
Example:
from flexget import schema @schema.upgrade('your_plugin') def upgrade(ver, session): if ver == 2: # upgrade ver = 3 return ver
- Parameters:
plugin (str)
- Return type:
Callable