biodm.components.table module
SQLAlchemy tables declarative parent classes - Declarative Base - S3File entity - Versioned
- class Base(**kwargs: Any)
Bases:
DeclarativeBase
,AsyncAttrs
Base class for ORM declarative Tables.
- Parameters:
svc (DatabaseService) – Enable entity - service linkage
ctrl (ResourceController) – Enable entity - controller linkage -> Resources tables only
- classmethod col(name: str)
Return columns object from name.
- classmethod colinfo(name: str) Tuple[Column, type]
Return column and associated python type for conditions.
- ctrl: ClassVar[Type[ResourceController]]
- classmethod dyn_relationships()
Return table relationships. dyn stands for dynamic -> use for setup.
- classmethod has_default(name: str) bool
Flag if column has default value.
- has_submitter_username = False
- classmethod is_autoincrement(name: str) bool
Flag if column is autoincrement.
Warning! This check is backend dependent and should be changed when supporting a new one. E.g. Oracle backend will not react appropriately. - https://groups.google.com/g/sqlalchemy/c/o5YQNH5UUko
- is_versioned = False
- metadata: ClassVar[MetaData] = MetaData()
Refers to the
_schema.MetaData
collection that will be used for new_schema.Table
objects.See also
- pk() OrderedSet[str]
Return primary key names.
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>
Refers to the
_orm.registry
in use where new_orm.Mapper
objects will be associated.
- relationships()
Table relationships. Memoized result -> use for runtime.
- required() Set[str]
Gets all required fields to create a new entry in this table.
- Returns:
fields name list
- Return type:
Set[str]
- svc: ClassVar[Type[DatabaseService]]
- classmethod target_table(name)
Return target table of a property.
- class S3File
Bases:
object
Class to use in order to have a file managed on S3 bucket associated to this table Defaults internal fields that are expected by S3Service.
- dl_count = Column(None, Integer(), table=None, nullable=False, server_default=DefaultClause('0', for_update=False))
- emited_at = Column(None, TIMESTAMP(timezone=True), table=None, nullable=False, default=CallableColumnDefault(<function utcnow>))
- extension = Column(None, String(length=10), table=None, nullable=False)
- filename = Column(None, String(length=100), table=None, nullable=False)
- key_salt = Column(None, String(), table=None, nullable=False, default=CallableColumnDefault(<function S3File.<lambda>>))
- ready = Column(None, BOOLEAN(), table=None, nullable=False, server_default=DefaultClause('0', for_update=False))
- size = Column(None, BigInteger(), table=None, nullable=False)
- upload = <_RelationshipDeclared at 0x7f53965f6cb0; no key>
- validated_at = Column(None, TIMESTAMP(timezone=True), table=None)