Login
Back to bricks list
Introduction Version

Typing

Typing class. This class allows storing information on all the types of the models in the system.

:property type: The type of the related model. :type type: str :property super_type: The super type of the related model. :type super_type: str :property root_type: The root type of the related task. :type root_type: str

Attributes

brick: CharFieldbrick_version: CharFielddata: Dictdeprecated_message: CharFielddeprecated_since: CharFieldhide: BooleanFieldhuman_name: CharFieldmodel_type: CharFieldobject_sub_type: CharFieldobject_type: CharFieldrelated_model_typing_name: CharFieldshort_description: CharFieldstyle: TypingStyleunique_name: CharField

Functions

__INIT__

Initialize self. See help(type(self)) for accurate signature.

CLONE
COERCE
Parameters:
NameTypeDefault valueDescription
_coercebool True
DELETE_INSTANCE
Parameters:
NameTypeDefault valueDescription
recursivebool False
delete_nullablebool False
DEPENDENCIES
Parameters:
NameTypeDefault valueDescription
search_nullablebool False
GET_ANCESTORS
Return type:
List
GET_ID
GET_MODEL_TYPE_DOC

Return the python documentation of the model type

Return type:
str
GET_PARENT_TYPING
Return type:
Optional
GET_TYPE
Return type:
Optional
GET_TYPE_STATUS
Return type:
TypingStatus
IS_ALIAS
IS_DIRTY
IS_SAVED

Returns True if the model is saved in db, False otherwise

Return type:
bool
REFRESH
Return type:
ModelType
REFRESH_ANCESTORS
SAVE

Sets the data set force_insert to True to force creation of the object set skip_hook to True to skip the before insert or update hook

:raises Exception: If the input data is not a dict

Return type:
ModelType
TO_DTO
Return type:
TypingDTO
TO_FULL_DTO
Return type:
TypingFullDTO
TO_REF_DTO
Return type:
TypingRefDTO
TO_SIMPLE_DTO
Return type:
SimpleTypingDTO
UNWRAP
ADD_INDEX - @classmethod
Parameters:
NameTypeDefault valueDescription
fieldsAny
AFTER_ALL_TABLES_INIT - @classmethod

Method call after all the table are inited

Useful when use DeferredForeignKey to create the foreign key manually latter

AFTER_TABLE_CREATION - @classmethod

Method call after the table is created

Usefull to create the full text indexes

ALIAS - @classmethod
Parameters:
NameTypeDefault valueDescription
aliasAny
BIND - @classmethod
Parameters:
NameTypeDefault valueDescription
databaseAny
bind_refsbool True
bind_backrefsbool True
_excludeAny
BIND_CTX - @classmethod
Parameters:
NameTypeDefault valueDescription
databaseAny
bind_refsbool True
bind_backrefsbool True
BULK_CREATE - @classmethod
Parameters:
NameTypeDefault valueDescription
model_listAny
batch_sizeAny
BULK_UPDATE - @classmethod
Parameters:
NameTypeDefault valueDescription
model_listAny
fieldsAny
batch_sizeAny
CLASSNAME - @classmethod

Returns the name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False True to slugify the class name if true, defaults to false , optional
snakefybool False True to snakefy the class name if true, defaults to false , optional
replace_uppercasebool False Replace upper cases by "-" if true, defaults to false , optional
Return type:
str
COLUMN_EXISTS - @classmethod

Returns True if the column exists in the table

Parameters:
NameTypeDefault valueDescription
column_namestr The column name ``
Return type:
bool
CREATE - @classmethod
Parameters:
NameTypeDefault valueDescription
queryAny
CREATE_FOREIGN_KEY_IF_NOT_EXIST - @classmethod

Create a foreign key for a Foreign key field only if the foreign key does not exists

Parameters:
NameTypeDefault valueDescription
fieldForeignKeyField [description]
CREATE_FULL_TEXT_INDEX - @classmethod

Method to create a full text index

Parameters:
NameTypeDefault valueDescription
columnsList [description] [str]
index_namestr
CREATE_TABLE - @classmethod

Create model table

DECORATED_METHOD_NAMES - @classmethod
Parameters:
NameTypeDefault valueDescription
decorator_nameAny
DELETE - @classmethod
DELETE_BY_ID - @classmethod
Parameters:
NameTypeDefault valueDescription
pkAny
DROP_TABLE - @classmethod

Drop model table

FILTER - @classmethod
Parameters:
NameTypeDefault valueDescription
dq_nodesAny
filtersAny
FOREIGN_KEY_EXISTS - @classmethod
Parameters:
NameTypeDefault valueDescription
column_namestr
Return type:
bool
FULL_CLASSNAME - @classmethod

Returns the full name of the class

Parameters:
NameTypeDefault valueDescription
slugifybool False Slugify the returned class name if true, defaults to false , optional
snakefybool False Snakefy the returned class name if true, defaults to false ``
Return type:
str
GET - @classmethod
Parameters:
NameTypeDefault valueDescription
queryAny
filtersAny
GET_BY_BRICK_AND_OBJECT_TYPE - @classmethod
Parameters:
NameTypeDefault valueDescription
brick_namestr
Return type:
List
GET_BY_BRICK_AND_UNIQUE_NAME - @classmethod
Parameters:
NameTypeDefault valueDescription
object_typeLiteral
brickstr
unique_namestr
Return type:
ModelSelect
GET_BY_ID - @classmethod
Parameters:
NameTypeDefault valueDescription
idstr
Return type:
Optional
GET_BY_ID_AND_CHECK - @classmethod

Get by ID and throw 404 error if object not found

Parameters:
NameTypeDefault valueDescription
idstr [description]
Return type:
ModelType
GET_BY_IDS - @classmethod
Parameters:
NameTypeDefault valueDescription
idsList
Return type:
List
GET_BY_MODEL_TYPE - @classmethod
Parameters:
NameTypeDefault valueDescription
model_typeType
Return type:
Typing
GET_BY_OBJECT_SUB_TYPE - @classmethod
Parameters:
NameTypeDefault valueDescription
sub_typestr
Return type:
List
GET_BY_OBJECT_TYPE - @classmethod

Return all the visible typing name of a type.

Parameters:
NameTypeDefault valueDescription
object_typeLiteral
Return type:
ModelSelect
GET_BY_OBJECT_TYPE_AND_NAME - @classmethod

Return all the visible typing name of a type searched by name.

Parameters:
NameTypeDefault valueDescription
object_typeLiteral
namestr
Return type:
ModelSelect
GET_BY_TYPE_AND_BRICK - @classmethod

Return all the visible typing name of a type.

Parameters:
NameTypeDefault valueDescription
object_typeLiteral
brick_namestr
Return type:
ModelSelect
GET_BY_TYPING_NAME - @classmethod
Parameters:
NameTypeDefault valueDescription
typing_namestr
Return type:
Typing
GET_CHILDREN_TYPINGS - @classmethod

Retunr the list of typings that are a child class of the provided model_type

Parameters:
NameTypeDefault valueDescription
typing_typeLiteral
base_typeType
Return type:
List
GET_DB - @classmethod
Return type:
DatabaseProxy
GET_DB_MANAGER - @classmethod

Returns the (current) DbManager of this model

Return type:
Type
GET_OR_CREATE - @classmethod
GET_OR_NONE - @classmethod
Parameters:
NameTypeDefault valueDescription
queryAny
filtersAny
GET_TABLE_NAME - @classmethod

Returns the table name of this class

Return type:
str
INDEX - @classmethod
Parameters:
NameTypeDefault valueDescription
fieldsAny
INDEX_EXISTS - @classmethod

Returns True if the index exists in the table

Parameters:
NameTypeDefault valueDescription
index_namestr The index name ``
Return type:
bool
INHERITORS - @classmethod

Get all the classes that inherit this class

Return type:
List
INSERT - @classmethod
Parameters:
NameTypeDefault valueDescription
_Model__dataAny
insertAny
INSERT_FROM - @classmethod
Parameters:
NameTypeDefault valueDescription
queryAny
fieldsAny
INSERT_MANY - @classmethod
Parameters:
NameTypeDefault valueDescription
rowsAny
fieldsAny
IS_MYSQL_ENGINE - @classmethod
METHOD_NAMES - @classmethod

Returns the list of the methods

Return type:
List
MODULE_NAME - @classmethod

Returns the module name of the class

Return type:
str
NOOP - @classmethod
PROPERTY_METHOD_NAMES - @classmethod
PROPERTY_NAMES - @classmethod

Retrieves the property names

Parameters:
NameTypeDefault valueDescription
instancetype The s of the properties to retrieve. set `none` to retrieve all. `type` or `union[type]`
excludetype
Return type:
List
RAW - @classmethod
Parameters:
NameTypeDefault valueDescription
sqlAny
paramsAny
REPLACE - @classmethod
Parameters:
NameTypeDefault valueDescription
_Model__dataAny
insertAny
REPLACE_MANY - @classmethod
Parameters:
NameTypeDefault valueDescription
rowsAny
fieldsAny
SAVE_ALL - @classmethod
SELECT - @classmethod
Parameters:
NameTypeDefault valueDescription
fieldsAny
SET_BY_ID - @classmethod
Parameters:
NameTypeDefault valueDescription
keyAny
valueAny
TABLE_EXISTS - @classmethod
TRUNCATE_TABLE - @classmethod
Parameters:
NameTypeDefault valueDescription
optionsAny
TYPE_IS_REGISTER - @classmethod
Parameters:
NameTypeDefault valueDescription
model_typeType
Return type:
bool
UPDATE - @classmethod
Parameters:
NameTypeDefault valueDescription
_Model__dataAny
updateAny
VALIDATE_MODEL - @classmethod
COPY - @staticmethod
Parameters:
NameTypeDefault valueDescription
methodAny
TYPING_NAME_IS_PROTOCOL - @staticmethod
Parameters:
NameTypeDefault valueDescription
typing_namestr
Return type:
bool