Attributes
data: Dict[str, Any]
flagged: bool
folder: SpaceFolder
fs_node_model: FSNodeModel
generated_by_port_name: str
id: str
name: str
origin: ResourceOrigin
parent_resource_id: str
scenario: Scenario
style: TypingStyle
task_model: TaskModel
Functions
__INIT__
Initialize self. See help(type(self)) for accurate signature.
ARCHIVE
CLONE
DELETE_INSTANCE
DELETE_RESOURCE_CONTENT
DEPENDENCIES
Parameters:
|
search_nullable | bool | False | |
GET_AND_CHECK_RESOURCE_TYPE
GET_ID
GET_RESOURCE
Returns the resource created from the data and resource_typing_name
if new_instance, it forces to rebuild the resource
IS_ALIAS
IS_DIRTY
IS_SAVED
Returns True if the model is saved in db, False otherwise
RECEIVE_FIELDS_FROM_RESOURCE
for each BaseRField of the resource, store its value to the data or kvstore
Parameters:
|
resource | Resource | | [description] |
REMOVE_KV_STORE
Remove the kv store if it exists
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
SAVE_FULL
UNWRAP
AFTER_ALL_TABLES_INIT
- @classmethodCreate the foreign keys because it was deffered
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 |
CLEAR_FOLDER
- @classmethodClear folders from all the entities that have the folder
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 DELETE_LIST
- @classmethod DELETE_MULTIPLE_RESOURCES
- @classmethod Parameters:
|
resources | List[ResourceModel] | | |
DELETE_RESOURCE_BY_TASK_MODEL
- @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
`` |
FIND_BY_FS_NODE_ID
- @classmethod Return type:
Optional['ResourceModel'] |
FOREIGN_KEY_EXISTS
- @classmethod FROM_RESOURCE
- @classmethodCreate a new ResourceModel from a resource
Don't set the resource here so it is regenerate on next get (avoid using same instance)
Parameters:
|
resource | Resource | | |
origin | ResourceOrigin | ResourceOrigin.GENERATED | |
scenario | Optional[Scenario] | | |
task_model | Optional[TaskModel] | | |
port_name | str | | |
flagged | bool | | |
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_BY_SCENARIO
- @classmethod GET_BY_SCENARIOS
- @classmethod GET_BY_TASK_MODEL
- @classmethod GET_BY_TASK_MODELS
- @classmethod GET_BY_TYPES_AND_SUB
- @classmethod GET_BY_TYPES_AND_SUB_EXPRESSION
- @classmethodReturn the expression to search resource base on a type and all its subtypes.
If the Resource type is provided, it returns None
GET_DB_MANAGER
- @classmethodReturns the (current) DbManager of this model
GET_OR_CREATE
- @classmethod
GET_OR_NONE
- @classmethod GET_RESOURCE_BY_SCENARIO_AND_FLAG
- @classmethod Parameters:
|
scenario_id | str | | |
flagged | bool | | |
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
SAVE_FROM_RESOURCE
- @classmethodCreate the ResourceModel from the Resource and save it
Parameters:
|
resource | Resource | | |
origin | ResourceOrigin | ResourceOrigin.GENERATED | |
scenario | Scenario | | |
task_model | TaskModel | | |
port_name | str | | |
flagged | bool | | |
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 | | |
SELECT_BY_RESOURCE_TYPING_NAME
- @classmethod SELECT_BY_TYPE_AND_SUB_TYPES
- @classmethodselect resource by type of any subclass of this type
Parameters:
|
type_ | Type[Resource] | | _description_ |
TABLE_EXISTS
- @classmethod
TRUNCATE_TABLE
- @classmethod VALIDATE_MODEL
- @classmethod