xia_engine.base.BaseEngine

class xia_engine.base.BaseEngine

Bases: object

Engine Definition

\* encoders map ('Field.class'

‘callable’): Which field type should use which encoder function

\* decoder map ('Field.class'

‘callable’): Which field type should use which decoder function

__init__()

Methods

__init__()

get_decoder(field[, inner_field])

Get Decoder for a field

get_encoder(field[, inner_field])

Get Encoder for a field

parse_search_option(key)

Reference to search method for the specifications

parse_update_option(key)

Reference to update method for the specifications

Attributes

MATCH_OPERATIONS

OPERATORS

search options

ORDER_TYPES

order options

UPDATE_TYPES

update options

analyzer

Analytic Compiler

async_create

Supporting async in asynchronous mode

async_read

Supporting read in asynchronous mode

backup_coder

Coder to be used to backup / restore

backup_storer

Storer to be used to backup / restore

decoders

Engine specific value decoder

encoders

Engine specific value encoder

engine_connector

Connector function

engine_connector_class

Connector Class use an object to handler parameters

engine_db_shared

if the value is False, each data model will have its own connector by default

engine_default_connector_param

default connection parameter

engine_foreign_key_check

Dependency check will be performed at engine level

engine_param

Engine parameter name

engine_scope_check

Scope check will be performed at engine level (pass document level check)

engine_unique_check

Unique check will be performed at engine level (pass document level check)

key_required

scan_and_fetch

Possible to separate the search operation into scan and fetch

store_embedded_as_table

Store embedded document as separate tables

support_unknown

OPERATORS = {'__eq__': '==', '__ge__': '>=', '__gt__': '>', '__le__': '<=', '__like__': 'LIKE', '__lt__': '<', '__ne__': '!='}

search options

ORDER_TYPES = {'__asc__': 'asc', '__desc__': 'desc'}

order options

UPDATE_TYPES = {'__append__': 'append', '__delete__': 'delete', '__inc__': 'increase', '__mul__': 'multiply', '__remove__': 'remove'}

update options

analyzer = None

Analytic Compiler

async_create: bool = False

Supporting async in asynchronous mode

async_read: bool = False

Supporting read in asynchronous mode

backup_coder = None

Coder to be used to backup / restore

backup_storer = None

Storer to be used to backup / restore

decoders = {}

Engine specific value decoder

encoders = {}

Engine specific value encoder

engine_connector: callable = None

Connector function

engine_connector_class = None

Connector Class use an object to handler parameters

engine_db_shared = True

if the value is False, each data model will have its own connector by default

engine_default_connector_param: dict = {}

default connection parameter

engine_foreign_key_check: bool = False

Dependency check will be performed at engine level

engine_param: str = None

Engine parameter name

engine_scope_check: bool = False

Scope check will be performed at engine level (pass document level check)

engine_unique_check: bool = False

Unique check will be performed at engine level (pass document level check)

classmethod get_decoder(field: type, inner_field: Optional[type] = None) callable

Get Decoder for a field

Parameters
  • field (type) – class type of field class

  • inner_field (type) – class type of inner field (Such qs ListField)

Returns

Decoder function

classmethod get_encoder(field: type, inner_field: Optional[type] = None) callable

Get Encoder for a field

Parameters
  • field (type) – class type of field class

  • inner_field (type) – class type of inner field (Such qs ListField)

Returns

Encoder function

classmethod parse_search_option(key: str)

Reference to search method for the specifications

Parameters

key (str) –

Returns

key, operator, order

classmethod parse_update_option(key: str)

Reference to update method for the specifications

Parameters

key (str) –

Returns

key, update

scan_and_fetch: bool = False

Possible to separate the search operation into scan and fetch

store_embedded_as_table: bool = False

Store embedded document as separate tables