<h1>royalnet.database<aclass="headerlink"href="#royalnet-database"title="Permalink to this headline">¶</a></h1>
<divclass="toctree-wrapper compound">
</div>
<spanclass="target"id="module-royalnet.database"></span><p>Relational database classes and methods.</p>
<dlclass="class">
<dtid="royalnet.database.Alchemy">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.</code><codeclass="descname">Alchemy</code><spanclass="sig-paren">(</span><em>database_uri: str, tables: Set[T]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.database.Alchemy"title="Permalink to this definition">¶</a></dt>
<dd><p>A wrapper around SQLAlchemy declarative that allows to use multiple databases at once while maintaining a single table-class for both of them.</p>
<dlclass="method">
<dtid="royalnet.database.Alchemy.__init__">
<codeclass="descname">__init__</code><spanclass="sig-paren">(</span><em>database_uri: str, tables: Set[T]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.database.Alchemy.__init__"title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new Alchemy object.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>database_uri</strong>– The uri of the database, as described at <aclass="reference external"href="https://docs.sqlalchemy.org/en/13/core/engines.html">https://docs.sqlalchemy.org/en/13/core/engines.html</a> .</p></li>
<li><p><strong>tables</strong>– The set of tables to be created and used in the selected database. Check the tables submodule for more details.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dlclass="method">
<dtid="royalnet.database.Alchemy._create_tables">
<codeclass="descname">_create_tables</code><spanclass="sig-paren">(</span><em>tables: Set[T]</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.database.Alchemy._create_tables"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="method">
<dtid="royalnet.database.Alchemy.session_acm">
<codeclass="descname">session_acm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.database.Alchemy.session_acm"title="Permalink to this definition">¶</a></dt>
<dd><p>Use Alchemy as a asyncronous context manager (to be used in async with statements).</p>
</dd></dl>
<dlclass="method">
<dtid="royalnet.database.Alchemy.session_cm">
<codeclass="descname">session_cm</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.database.Alchemy.session_cm"title="Permalink to this definition">¶</a></dt>
<dd><p>Use Alchemy as a context manager (to be used in with statements).</p>
</dd></dl>
</dd></dl>
<dlclass="function">
<dtid="royalnet.database.relationshiplinkchain">
<codeclass="descclassname">royalnet.database.</code><codeclass="descname">relationshiplinkchain</code><spanclass="sig-paren">(</span><em>starting_class</em>, <em>ending_class</em><spanclass="sig-paren">)</span>→ Optional[tuple]<aclass="headerlink"href="#royalnet.database.relationshiplinkchain"title="Permalink to this definition">¶</a></dt>
<dd><p>Find the path to follow to get from the starting table to the ending table.</p>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.DatabaseConfig">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.</code><codeclass="descname">DatabaseConfig</code><spanclass="sig-paren">(</span><em>database_uri: str, master_table: Type[CT_co], identity_table: Type[CT_co], identity_column_name: str</em><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.database.DatabaseConfig"title="Permalink to this definition">¶</a></dt>
<dd><p>The configuration to be used for the <spanclass="xref std std-ref">royalnet.database.Alchemy</span> component of <spanclass="xref std std-ref">royalnet.bots.GenericBot</span>.</p>
<spanid="tables"></span><h2>Tables<aclass="headerlink"href="#module-royalnet.database.tables"title="Permalink to this headline">¶</a></h2>
<dlclass="class">
<dtid="royalnet.database.tables.Royal">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">Royal</code><aclass="headerlink"href="#royalnet.database.tables.Royal"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="attribute">
<dtid="royalnet.database.tables.Royal.avatar">
<codeclass="descname">avatar</code><emclass="property"> = Column(None, LargeBinary(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Royal.avatar"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Royal.password">
<codeclass="descname">password</code><emclass="property"> = Column(None, LargeBinary(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Royal.password"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Royal.role">
<codeclass="descname">role</code><emclass="property"> = Column(None, String(), table=None, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Royal.role"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Royal.uid">
<codeclass="descname">uid</code><emclass="property"> = Column(None, Integer(), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Royal.uid"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Royal.username">
<codeclass="descname">username</code><emclass="property"> = Column(None, String(), table=None, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Royal.username"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.tables.Telegram">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">Telegram</code><aclass="headerlink"href="#royalnet.database.tables.Telegram"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">first_name</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Telegram.first_name"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">last_name</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Telegram.last_name"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">mention</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#royalnet.database.tables.Telegram.mention"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal</code><emclass="property"> = <RelationshipProperty at 0x7f81332fcbc8; no key></em><aclass="headerlink"href="#royalnet.database.tables.Telegram.royal"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal_id</code><emclass="property"> = Column(None, Integer(), ForeignKey('royals.uid'), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Telegram.royal_id"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Telegram.tg_id">
<codeclass="descname">tg_id</code><emclass="property"> = Column(None, BigInteger(), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Telegram.tg_id"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">username</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Telegram.username"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.tables.Diario">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">Diario</code><aclass="headerlink"href="#royalnet.database.tables.Diario"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="attribute">
<dtid="royalnet.database.tables.Diario.context">
<codeclass="descname">context</code><emclass="property"> = Column(None, Text(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.context"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">creator</code><emclass="property"> = <RelationshipProperty at 0x7f81333176c8; no key></em><aclass="headerlink"href="#royalnet.database.tables.Diario.creator"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">creator_id</code><emclass="property"> = Column(None, Integer(), ForeignKey('royals.uid'), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.creator_id"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">diario_id</code><emclass="property"> = Column(None, Integer(), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.diario_id"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">media_url</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.media_url"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Diario.quoted">
<codeclass="descname">quoted</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.quoted"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">quoted_account</code><emclass="property"> = <RelationshipProperty at 0x7f8133317948; no key></em><aclass="headerlink"href="#royalnet.database.tables.Diario.quoted_account"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">quoted_account_id</code><emclass="property"> = Column(None, Integer(), ForeignKey('royals.uid'), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.quoted_account_id"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Diario.spoiler">
<codeclass="descname">spoiler</code><emclass="property"> = Column(None, Boolean(), table=None, default=ColumnDefault(False))</em><aclass="headerlink"href="#royalnet.database.tables.Diario.spoiler"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Diario.text">
<codeclass="descname">text</code><emclass="property"> = Column(None, Text(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.text"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">timestamp</code><emclass="property"> = Column(None, DateTime(), table=None, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Diario.timestamp"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.tables.Alias">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">Alias</code><aclass="headerlink"href="#royalnet.database.tables.Alias"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="attribute">
<dtid="royalnet.database.tables.Alias.alias">
<codeclass="descname">alias</code><emclass="property"> = Column(None, String(), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Alias.alias"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal</code><emclass="property"> = <RelationshipProperty at 0x7f8133317ec8; no key></em><aclass="headerlink"href="#royalnet.database.tables.Alias.royal"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal_id</code><emclass="property"> = Column(None, Integer(), ForeignKey('royals.uid'), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Alias.royal_id"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.tables.ActiveKvGroup">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">ActiveKvGroup</code><aclass="headerlink"href="#royalnet.database.tables.ActiveKvGroup"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">group</code><emclass="property"> = <RelationshipProperty at 0x7f8133317a48; no key></em><aclass="headerlink"href="#royalnet.database.tables.ActiveKvGroup.group"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">group_name</code><emclass="property"> = Column(None, String(), ForeignKey('keygroups.group_name'), table=None, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.ActiveKvGroup.group_name"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal</code><emclass="property"> = <RelationshipProperty at 0x7f81333171c8; no key></em><aclass="headerlink"href="#royalnet.database.tables.ActiveKvGroup.royal"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal_id</code><emclass="property"> = Column(None, Integer(), ForeignKey('royals.uid'), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.ActiveKvGroup.royal_id"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.tables.Keyvalue">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">Keyvalue</code><aclass="headerlink"href="#royalnet.database.tables.Keyvalue"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">group</code><emclass="property"> = <RelationshipProperty at 0x7f81333173c8; no key></em><aclass="headerlink"href="#royalnet.database.tables.Keyvalue.group"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">group_name</code><emclass="property"> = Column(None, String(), ForeignKey('keygroups.group_name'), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Keyvalue.group_name"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Keyvalue.key">
<codeclass="descname">key</code><emclass="property"> = Column(None, String(), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Keyvalue.key"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="attribute">
<dtid="royalnet.database.tables.Keyvalue.value">
<codeclass="descname">value</code><emclass="property"> = Column(None, String(), table=None, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Keyvalue.value"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.tables.Keygroup">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">Keygroup</code><aclass="headerlink"href="#royalnet.database.tables.Keygroup"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">group_name</code><emclass="property"> = Column(None, String(), ForeignKey('keygroups.group_name'), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Keygroup.group_name"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dlclass="class">
<dtid="royalnet.database.tables.Discord">
<emclass="property">class </em><codeclass="descclassname">royalnet.database.tables.</code><codeclass="descname">Discord</code><aclass="headerlink"href="#royalnet.database.tables.Discord"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">avatar_hash</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Discord.avatar_hash"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">discord_id</code><emclass="property"> = Column(None, BigInteger(), table=None, primary_key=True, nullable=False)</em><aclass="headerlink"href="#royalnet.database.tables.Discord.discord_id"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">discriminator</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Discord.discriminator"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">full_username</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#royalnet.database.tables.Discord.full_username"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal</code><emclass="property"> = <RelationshipProperty at 0x7f8133317948; no key></em><aclass="headerlink"href="#royalnet.database.tables.Discord.royal"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">royal_id</code><emclass="property"> = Column(None, Integer(), ForeignKey('royals.uid'), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Discord.royal_id"title="Permalink to this definition">¶</a></dt>
<codeclass="descname">username</code><emclass="property"> = Column(None, String(), table=None)</em><aclass="headerlink"href="#royalnet.database.tables.Discord.username"title="Permalink to this definition">¶</a></dt>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <ahref="https://readthedocs.org">Read the Docs</a>.