ORM Python Module

Cart Object Relational Model.

Using PeeWee to implement the ORM.

class pacifica.cartd.orm.Cart(*args, **kwargs)

Cart object model.

DoesNotExist

alias of CartDoesNotExist

class pacifica.cartd.orm.CartBase(*args, **kwargs)

Base Cart Model class.

DoesNotExist

alias of CartBaseDoesNotExist

classmethod atomic()

Do the DB atomic bits.

classmethod database_close()

Close the database connection.

classmethod database_connect()

Make sure database is connected.

Dont reopen connection.

reload()

Reload my current state from the DB.

class pacifica.cartd.orm.CartSystem(*args, **kwargs)

Cart Schema Version Model.

DoesNotExist

alias of CartSystemDoesNotExist

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.cartd.orm.File(*args, **kwargs)

File object model to keep track of what’s been downloaded for a cart.

DoesNotExist

alias of FileDoesNotExist

class pacifica.cartd.orm.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 Version Control:

class orm_update:
  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 create_tables()

Create the tables if they don’t exist.

static dbconn_blocking()

Wait for the db connection.

classmethod update_0_1_to_1_0()

Update by adding the boolean column.

classmethod update_tables()

Update the database to the current version.