royalnet.database¶
-
class
royalnet.database.
Alchemy
(database_uri: str, tables: Set[T])¶ A wrapper around SQLAlchemy declarative that allows to use multiple databases at once while maintaining a single table-class for both of them.
-
__init__
(database_uri: str, tables: Set[T])¶ Create a new Alchemy object.
- Parameters
database_uri – The uri of the database, as described at https://docs.sqlalchemy.org/en/13/core/engines.html .
tables – The set of tables to be created and used in the selected database. Check the tables submodule for more details.
-
_create_tables
(tables: Set[T])¶
-
session_acm
()¶ Use Alchemy as a asyncronous context manager (to be used in async with statements).
-
session_cm
()¶ Use Alchemy as a context manager (to be used in with statements).
-
-
royalnet.database.
relationshiplinkchain
(starting_class, ending_class) → Optional[tuple]¶ Find the path to follow to get from the starting table to the ending table.
-
class
royalnet.database.
DatabaseConfig
(database_uri: str, master_table: Type[CT_co], identity_table: Type[CT_co], identity_column_name: str)¶ The configuration to be used for the royalnet.database.Alchemy component of royalnet.bots.GenericBot.
Tables¶
-
class
royalnet.database.tables.
Royal
¶ -
avatar
= Column(None, LargeBinary(), table=None)¶
-
password
= Column(None, LargeBinary(), table=None)¶
-
role
= Column(None, String(), table=None, nullable=False)¶
-
uid
= Column(None, Integer(), table=None, primary_key=True, nullable=False)¶
-
username
= Column(None, String(), table=None, nullable=False)¶
-
-
class
royalnet.database.tables.
Telegram
¶ -
first_name
= Column(None, String(), table=None)¶
-
last_name
= Column(None, String(), table=None)¶
-
mention
() → str¶
-
royal
= <RelationshipProperty at 0x7a70300; no key>¶
-
royal_id
= Column(None, Integer(), ForeignKey('royals.uid'), table=None)¶
-
tg_id
= Column(None, BigInteger(), table=None, primary_key=True, nullable=False)¶
-
username
= Column(None, String(), table=None)¶
-
-
class
royalnet.database.tables.
Diario
¶ -
context
= Column(None, Text(), table=None)¶
-
creator
= <RelationshipProperty at 0x7a70348; no key>¶
-
creator_id
= Column(None, Integer(), ForeignKey('royals.uid'), table=None, nullable=False)¶
-
diario_id
= Column(None, Integer(), table=None, primary_key=True, nullable=False)¶
-
media_url
= Column(None, String(), table=None)¶
-
quoted
= Column(None, String(), table=None)¶
-
quoted_account
= <RelationshipProperty at 0x7a70978; no key>¶
-
quoted_account_id
= Column(None, Integer(), ForeignKey('royals.uid'), table=None)¶
-
spoiler
= Column(None, Boolean(), table=None, default=ColumnDefault(False))¶
-
text
= Column(None, Text(), table=None)¶
-
timestamp
= Column(None, DateTime(), table=None, nullable=False)¶
-
-
class
royalnet.database.tables.
Alias
¶ -
alias
= Column(None, String(), table=None, primary_key=True, nullable=False)¶
-
royal
= <RelationshipProperty at 0x7a70198; no key>¶
-
royal_id
= Column(None, Integer(), ForeignKey('royals.uid'), table=None)¶
-
-
class
royalnet.database.tables.
ActiveKvGroup
¶ -
group
= <RelationshipProperty at 0x7a701e0; no key>¶
-
group_name
= Column(None, String(), ForeignKey('keygroups.group_name'), table=None, nullable=False)¶
-
royal
= <RelationshipProperty at 0x7a70b70; no key>¶
-
royal_id
= Column(None, Integer(), ForeignKey('royals.uid'), table=None, primary_key=True, nullable=False)¶
-
-
class
royalnet.database.tables.
Keyvalue
¶ -
group
= <RelationshipProperty at 0x7a709c0; no key>¶
-
group_name
= Column(None, String(), ForeignKey('keygroups.group_name'), table=None, primary_key=True, nullable=False)¶
-
key
= Column(None, String(), table=None, primary_key=True, nullable=False)¶
-
value
= Column(None, String(), table=None, nullable=False)¶
-
-
class
royalnet.database.tables.
Keygroup
¶ -
group_name
= Column(None, String(), ForeignKey('keygroups.group_name'), table=None, primary_key=True, nullable=False)¶
-
-
class
royalnet.database.tables.
Discord
¶ -
avatar_hash
= Column(None, String(), table=None)¶
-
discord_id
= Column(None, BigInteger(), table=None, primary_key=True, nullable=False)¶
-
discriminator
= Column(None, String(), table=None)¶
-
full_username
()¶
-
royal
= <RelationshipProperty at 0x7a70a08; no key>¶
-
royal_id
= Column(None, Integer(), ForeignKey('royals.uid'), table=None)¶
-
username
= Column(None, String(), table=None)¶
-