Functions
__INIT__
Initialize self. See help(type(self)) for accurate signature.
ADD_MESSAGE
Parameters:
|
message | str | | |
type_ | MessageLevel | INFO | |
CLONE
DELETE_INSTANCE
Parameters:
|
recursive | bool | False | |
delete_nullable | bool | False | |
DEPENDENCIES
Parameters:
|
search_nullable | bool | False | |
GET_ELAPSED_TIME
Calculate the elapsed time in milliseconds
GET_ID
GET_LAST_EXECUTION_TIME
Must be called only when the progress bar is finished
Get the last execution time. If no second start, return the execution duration, else return the second start duration
GET_MESSAGES_PAGINATED
Get the last nb_of_messages messages
Parameters:
|
nb_of_messages | int | | Number of messages to get |
before_date | datetime | | |
IS_ALIAS
IS_DIRTY
IS_SAVED
Returns True if the model is saved in db, False otherwise
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
START
STOP_ERROR
Parameters:
|
error_message | str | | |
elapsed_time | float | | |
STOP_SUCCESS
Parameters:
|
success_message | str | | |
elapsed_time | float | | |
TRIGGER_SECOND_START
UNWRAP
UPDATE_PROGRESS
Increment the progress-bar value and log a progress message
AFTER_ALL_TABLES_INIT
- @classmethodMethod call after all the table are inited
Useful when use DeferredForeignKey to create the foreign key manually latter
AFTER_TABLE_CREATION
- @classmethodMethod call after the table is created
Usefull to create the full text indexes
BIND
- @classmethod Parameters:
|
database | Any | | |
bind_refs | bool | True | |
bind_backrefs | bool | True | |
_exclude | Any | | |
BIND_CTX
- @classmethod Parameters:
|
database | Any | | |
bind_refs | bool | True | |
bind_backrefs | bool | True | |
BULK_CREATE
- @classmethod Parameters:
|
model_list | Any | | |
batch_size | Any | | |
BULK_UPDATE
- @classmethod Parameters:
|
model_list | Any | | |
fields | Any | | |
batch_size | Any | | |
CLASSNAME
- @classmethodReturns the name of the class
Parameters:
|
slugify | bool | False | True to slugify the class name if true, defaults to false
, optional |
snakefy | bool | False | True to snakefy the class name if true, defaults to false
, optional |
replace_uppercase | bool | False | Replace upper cases by "-" if true, defaults to false
, optional |
COLUMN_EXISTS
- @classmethodReturns True if the column exists in the table
Parameters:
|
column_name | str | | The column name
`` |
CREATE_FOREIGN_KEY_IF_NOT_EXIST
- @classmethodCreate a foreign key for a Foreign key field only if the foreign key does not exists
Parameters:
|
field | ForeignKeyField | | [description] |
CREATE_FULL_TEXT_INDEX
- @classmethodMethod to create a full text index
Parameters:
|
columns | List | | [description]
[str] |
index_name | str | | |
CREATE_TABLE
- @classmethod DECORATED_METHOD_NAMES
- @classmethod DELETE
- @classmethod
DELETE_BY_ID
- @classmethod DROP_TABLE
- @classmethod EXECUTE_SQL
- @classmethodExecute a raw SQL query. Can use the [TABLE_NAME] to replace by the table name
Parameters:
|
query | str | | The query to execute
`` |
FOREIGN_KEY_EXISTS
- @classmethod FROM_CONFIG_DTO
- @classmethod FULL_CLASSNAME
- @classmethodReturns the full name of the class
Parameters:
|
slugify | bool | False | Slugify the returned class name if true, defaults to false
, optional |
snakefy | bool | False | Snakefy the returned class name if true, defaults to false
`` |
GET_BY_ID_AND_CHECK
- @classmethodGet by ID and throw 404 error if object not found
GET_BY_IDS
- @classmethod GET_DB_MANAGER
- @classmethodReturns the (current) DbManager of this model
GET_OR_CREATE
- @classmethod
GET_OR_NONE
- @classmethod GET_TABLE_NAME
- @classmethodReturns the table name of this class
INDEX_EXISTS
- @classmethodReturns True if the index exists in the table
Parameters:
|
index_name | str | | The index name
`` |
INHERITORS
- @classmethodGet all the classes that inherit this class
INSERT_FROM
- @classmethod INSERT_MANY
- @classmethod IS_MYSQL_ENGINE
- @classmethod
METHOD_NAMES
- @classmethodReturns the list of the methods
MODULE_NAME
- @classmethodReturns the module name of the class
NOOP
- @classmethod
PROPERTY_METHOD_NAMES
- @classmethod
PROPERTY_NAMES
- @classmethodRetrieves the property names
Parameters:
|
instance | type | | The s of the properties to retrieve. set `none` to retrieve all.
`type` or `union[type]` |
exclude | type | | |
REPLACE_MANY
- @classmethod SAVE_ALL
- @classmethod
SEARCH
- @classmethodPerforms full-text search on the field. Must be overrided by child class to work
Parameters:
|
phrase | str | | The phrase to search
`` |
modifier | str | | |
TABLE_EXISTS
- @classmethod
TRUNCATE_TABLE
- @classmethod VALIDATE_MODEL
- @classmethod