Sync Python Module¶
The ORM Sync Module.
-
class
pacifica.metadata.orm.sync.
MetadataSystem
(*args, **kwargs)¶ Metadata Schema Version Model.
-
DoesNotExist
¶ alias of
MetadataSystemDoesNotExist
-
classmethod
get_or_create_version
()¶ Set or create the current version of the schema.
-
classmethod
get_version
()¶ Get the current version as a tuple.
-
classmethod
is_equal
()¶ Check to see if schema version matches code version.
-
classmethod
is_safe
()¶ Check to see if the schema version is safe for the code.
-
-
class
pacifica.metadata.orm.sync.
OrmSync
¶ Special module for syncing the orm.
This module should incorporate a schema migration strategy.
The supported versions migrating forward must be in a versions array containing tuples for major and minor versions.
The version tuples are directly translated to method names in the orm_update class for the update between those versions.
Example Methods:
class OrmSync: versions = [ (0, 1), (0, 2), (1, 0), (1, 1) ] def update_0_1_to_0_2(): pass def update_0_2_to_1_0(): pass
The body of the update should follow peewee migration practices. http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#migrate
-
__weakref__
¶ list of weak references to the object (if defined)
-
static
close
()¶ Close the database connection.
-
classmethod
connect_and_check
()¶ Connect and check the version.
-
static
create_tables
()¶ Create the tables for the objects if they exist.
-
static
dbconn_blocking
()¶ Wait for the db connection.
-
classmethod
update_0_1_to_1_0
()¶ Update from 0.1 to 1.0.
-
classmethod
update_tables
()¶ Update the database to the current version.
-