8.2.10.4.11.9. Role

class Role(**kwargs)[source]

Methods

__delattr__

Implement delattr(self, name).

__dir__

Default dir() implementation.

__eq__

Return self==value.

__format__

Default object formatter.

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__getstate__

Helper for pickle.

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

A simple constructor that allows initialization from kwargs.

__init_subclass__

This method is called when a class is subclassed.

__le__

Return self<=value.

__lt__

Return self<value.

__ne__

Return self!=value.

__new__

__reduce__

Helper for pickle.

__reduce_ex__

Helper for pickle.

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__

Size of object in memory, in bytes.

__str__

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

get_permissions

Return set of permissions associated with role.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

Attributes

__abstract__

__annotations__

__dict__

__doc__

__fsa__

Internal reference to the extension object.

__mapper__

__module__

__table__

__tablename__

__weakref__

list of weak references to the object

_sa_class_manager

_sa_registry

description

id

metadata

name

permissions

registry

update_datetime

__repr__()[source]

Return repr(self).

__annotations__ = {'__fsa__': 't.ClassVar[SQLAlchemy]', 'description': 'str | None', 'id': 'int', 'name': 'str', 'permissions': 'list[str] | None', 'query': 't.ClassVar[Query]', 'query_class': 't.ClassVar[type[Query]]', 'update_datetime': 'datetime'}
__doc__ = None
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x761729a4c550; Role>
__module__ = 'schedula.utils.form.server.security'
__table__ = Table('role', MetaData(), Column('id', Integer(), table=<role>, primary_key=True, nullable=False), Column('name', String(length=80), table=<role>, nullable=False), Column('description', String(length=255), table=<role>), Column('permissions', AsaList(), table=<role>), Column('update_datetime', DateTime(), table=<role>, nullable=False, onupdate=CallableColumnDefault(<function naive_utcnow>), server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x76172983c890; now>, for_update=False)), schema=None)
__tablename__ = 'role'
_sa_class_manager = {'description': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'permissions': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'update_datetime': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
description: str | None
id: int
name: str
permissions: list[str] | None
update_datetime: datetime
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.