websauna.system.model.columns module¶
Extra SQLAlchemy column declarations.
We have some sqlalchemy_utils aliasing here intenrally. In the future expect those aliases to be dropped in the favor of dropping sqlalchemy_utils dependency.
-
class
websauna.system.model.columns.
UTCDateTime
(*args, **kwargs)[source]¶ Bases:
sqlalchemy.sql.sqltypes.DateTime
An SQLAlchemy DateTime column that explicitly uses timezone aware dates and only accepts UTC.
-
class
websauna.system.model.columns.
UUID
(as_uuid=True)[source]¶ Bases:
sqlalchemy_utils.types.uuid.UUIDType
Generic UUID type.
Falls back to native PostgreSQL UUID implementation.
The resulting object is
uuid.UUID
.-
impl
= UUID()¶ We force PSQL implementation by default here so that Alembic migration scripts don’t do a column with unnecessary length attribute: sa.Column(‘uuid’, websauna.system.model.columns.UUID(length=16), nullable=True),
-
load_dialect_impl
(dialect)[source]¶ Return a
TypeEngine
object corresponding to a dialect.This is an end-user override hook that can be used to provide differing types depending on the given dialect. It is used by the
TypeDecorator
implementation oftype_engine()
to help determine what type should ultimately be returned for a givenTypeDecorator
.By default returns
self.impl
.
-
-
class
websauna.system.model.columns.
INET
(max_length=50, *args, **kwargs)[source]¶ Bases:
sqlalchemy_utils.types.ip_address.IPAddressType
Generic IPv4/IPv6 type.
Falls back to native PostgreSQL INET implementation.
The resulting object is either
ipaddress.IPv4Address
oripaddress.IPv6Address
.-
load_dialect_impl
(dialect)[source]¶ Return a
TypeEngine
object corresponding to a dialect.This is an end-user override hook that can be used to provide differing types depending on the given dialect. It is used by the
TypeDecorator
implementation oftype_engine()
to help determine what type should ultimately be returned for a givenTypeDecorator
.By default returns
self.impl
.
-