Fields¶
-
class
nefertari_sqla.fields.
BigIntegerField
(*args, **kwargs)¶ -
_sqla_type_cls
¶ alias of
LimitedBigInteger
-
-
class
nefertari_sqla.fields.
SmallIntegerField
(*args, **kwargs)¶ -
_sqla_type_cls
¶ alias of
LimitedSmallInteger
-
-
class
nefertari_sqla.fields.
BooleanField
(*args, **kwargs)¶ -
process_type_args
(kwargs)¶ - Changed:
- constraint_name -> name
-
-
class
nefertari_sqla.fields.
DateField
(*args, **kwargs)¶
-
class
nefertari_sqla.fields.
DateTimeField
(*args, **kwargs)¶
-
class
nefertari_sqla.fields.
StringField
(*args, **kwargs)¶ -
_sqla_type_cls
¶ alias of
LimitedString
-
process_type_args
(kwargs)¶ - Changed:
- max_length -> length
-
-
class
nefertari_sqla.fields.
UnicodeTextField
(*args, **kwargs)¶ -
_sqla_type_cls
¶ alias of
LimitedUnicodeText
-
-
class
nefertari_sqla.fields.
BinaryField
(*args, **kwargs)¶
-
class
nefertari_sqla.fields.
TimeField
(*args, **kwargs)¶
-
class
nefertari_sqla.fields.
PickleField
(*args, **kwargs)¶
-
class
nefertari_sqla.fields.
IntervalField
(*args, **kwargs)¶
-
class
nefertari_sqla.fields.
IdField
(*args, **kwargs)¶ Just a subclass of IntegerField that must be used for fields that represent database-specific ‘id’ field.
-
class
nefertari_sqla.fields.
ForeignKeyField
(*args, **kwargs)¶ Integer ForeignKey field.
This is the place where ondelete rules kwargs should be passed. If you switched from the mongodb engine, copy the same ondelete rules you passed to mongo’s Relationship constructor.
ondelete kwargs may be kept in both fields with no side-effects when switching between the sqla and mongo engines.
Developers are not encouraged to change the value of this field on model to add/update relationship. Use Relationship constructor with backreference settings instead.
-
__init__
(*args, **kwargs)¶ Override to determine self._sqla_type_cls.
Type is determined using ‘ref_column_type’ value from :kwargs:. Its value must be a *Field class of a field that is being referenced by FK field or a _sqla_type_cls of that *Field cls.
-
_generate_schema_item
(cleaned_kw)¶ Override default implementation to generate ‘ondelete’ and ‘onupdate’ arguments.
-
_get_referential_action
(kwargs, key)¶ Determine/translate generic rule name to SQLA-specific rule.
Output rule name is a valid SQL Referential action name. If ondelete kwarg is not provided, no referential action will be created.
- Valid kwargs for ondelete kwarg are:
- CASCADE Translates to SQL as CASCADE RESTRICT Translates to SQL as RESTRICT NULLIFY Translates to SQL as `SET NULL
Not supported SQL referential actions: NO ACTION, SET DEFAULT
-
_schema_class
¶ alias of
ForeignKey
-
-
class
nefertari_sqla.fields.
Relationship
¶ Thin wrapper around relationship.
The goal of this wrapper is to allow passing both relationship and backref arguments to a single function. Backref arguments should be prefixed with ‘backref_‘. This function splits relationship-specific and backref-specific arguments and makes a call like:
relationship(..., ..., backref=backref(...))Lazy: setting is set to ‘immediate’ on the ‘One’ side of One2One or One2Many relationships. This is done both for relationship itself and backref so ORM ‘after_update’ events are fired when relationship is updated. For backref ‘uselist’ is assumed to be False by default.
From SQLAlchemy docs: immediate - items should be loaded as the parents are loaded, using a separate SELECT statement, or identity map fetch for simple many-to-one references.
-
class
nefertari_sqla.fields.
ListField
(*args, **kwargs)¶ -
_sqla_type_cls
¶ alias of
ChoiceArray
-
process_type_args
(kwargs)¶ Covert field class to its _sqla_type_cls.
StringField & UnicodeField are replaced with corresponding Text fields because when String* fields are used, SQLA creates db column of postgresql type ‘varying[]’. But when querying that column with text, requested text if submited as ‘text[]’.
- Changed:
- item_type field class -> item_type field type
-