Database

We support Oracle and Postgres databases.

Multiple hosts

The dsn parameter of service database config should be specified to enable multihost option for Postgres.

DSN may be specified in the following format: luna:luna@postgres01:5432,postgres02:5432/luna_backport3?some_option=some_value. It is possible to partially fill in the DSN string (e.g. postgres01,postgres02/luna_backport3), and then the missing parameters will be filled in from proprietary parameter values (or defaults).

At startup, the service will create a pool of connections to one of DSN hosts available. In case of problems with establishing a connection after several unsuccessful attempts, the service will again try to set up a connection pool to any of DSN hosts available.

DB scheme.

_images/backport3_db.png

Backport3 database models.

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.Account(**kwargs)[source]

Database table model for account.

account_id

account id.

Type:

uuid4

active

account status (blocked or not).

Type:

bool

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.AccountToken(**kwargs)[source]

Token table.

account_id

account id, token is linked to

Type:

uuid4

token

token

Type:

str

token_id

token id

Type:

uuid4

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.DescriptorsList(**kwargs)[source]

Database table model for descriptors lists.

account_id

account id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

create_descr_list_time_index = Index('create_descr_list_time_index', Column('account_id', String(length=36), ForeignKey('account.account_id'), table=<descriptors_list>, comment='uuid4: id of the account to which the list belongs'), Column('create_time', TIMESTAMP(), table=<descriptors_list>, nullable=False, comment='list: person create time'))

index for pagination by list

create_time

date and time of creating list

Type:

DateTime

list_id

list id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.Handler(**kwargs)[source]

Database table model for handlers.

account_id

account uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”, to which this handler belong

Type:

str

create_time

date and time of creating handler

Type:

DateTime

classmethod getColumnNames()[source]

Get all column name of table.

Return type:

List[str]

Returns:

list of column name in order as in db

handler_id

handler id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

last_update_time

date and time of creating face

Type:

DateTime

policies

json with policies

Type:

str

type

handler type (extractor - 0, identify - 1, verify - 2)

Type:

integer

version

handler version

Type:

int

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.ListPerson(**kwargs)[source]

Database table model for links between persons and lists.

list_id

list id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

person_id

person id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.Person(**kwargs)[source]

Database table model for persons.

account_id

descriptor id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

create_time

date and time of creating person

Type:

DateTime

external_id

external id of the person, if it has its own mapping in external system

Type:

str

person_id

person id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

user_data

client info about the face

Type:

str

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.PersonFace(**kwargs)[source]

Database table model for links between persons and faces.

face_id

face id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

person_id

person id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

class luna_backport3.db.backport3_db_tools.models.backport3_db_models.PersonsList(**kwargs)[source]

Database table model for person lists.

account_id

account id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str

create_persons_list_time_index = Index('create_persons_list_time_index', Column('account_id', String(length=36), ForeignKey('account.account_id'), table=<persons_list>, comment='uuid4: id of the account to which the list belongs'), Column('create_time', TIMESTAMP(), table=<persons_list>, nullable=False, comment='date: list create time'))

index for pagination by list

create_time

date and time of creating list

Type:

DateTime

list_id

list id, uuid4 in format “xxxxxxxx-xxxx-4xxx-{8-9}xx-xxxxxxxxxxxx”

Type:

str