ORM Python Module

ORM for index server.

class pacifica.uniqueid.orm.OrmSync[source]

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 OrmSync class for the update between those versions.

Example Version Control:

class OrmSync:
    versions = [
        (0, 1),
        (0, 2),
        (1, 0),
        (1, 1)
    def update_0_1_to_0_2():
    def update_0_2_to_1_0():

The body of an update method should follow peewee migration practices. http://docs.peewee-orm.com/en/latest/peewee/playhouse.html#migrate

static dbconn_blocking()[source]

Wait for the db connection.

classmethod update_0_0_to_1_0()[source]

Update by adding the boolean column.

classmethod update_tables()[source]

Update the database to the current version.

versions = [(0, 0), (1, 0)]
class pacifica.uniqueid.orm.UniqueIndex(*args, **kwargs)[source]

Auto-generated by pwiz maps a python record to a mysql table.


alias of UniqueIndexDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
classmethod atomic()[source]

Get the atomic context or decorator.

classmethod database_close()[source]

Close the database connection.

Closing already closed database throws an error so catch it and continue on.

classmethod database_connect()[source]

Make sure database is connected.

Trying to connect a second time doesnt cause any problems.

idid = <CharField: UniqueIndex.idid>
index = <BigIntegerField: UniqueIndex.index>
class pacifica.uniqueid.orm.UniqueIndexBase(*args, **kwargs)[source]

UniqueIndex base model for database setup.


alias of UniqueIndexBaseDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
id = <AutoField: UniqueIndexBase.id>
class pacifica.uniqueid.orm.UniqueIndexSystem(*args, **kwargs)[source]

UniqueIndex Schema Version Model.


alias of UniqueIndexSystemDoesNotExist

_meta = <peewee.Metadata object>
_schema = <peewee.SchemaManager object>
classmethod get_or_create_version()[source]

Set or create the current version of the schema.

classmethod get_version()[source]

Get the current version as a tuple.

classmethod is_equal()[source]

Check to see if schema version matches code version.

classmethod is_safe()[source]

Check to see if the schema version is safe for the code.

part = <CharField: UniqueIndexSystem.part>
value = <IntegerField: UniqueIndexSystem.value>
pacifica.uniqueid.orm.update_index(id_range, id_mode)[source]

Update the index for a mode and returns a unique start and stop index.