Added docs for cpl.database
This commit is contained in:
parent
7b90b5af57
commit
e562c31033
BIN
docs/build/doctrees/cpl.database.connection.doctree
vendored
BIN
docs/build/doctrees/cpl.database.connection.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl.database.context.doctree
vendored
BIN
docs/build/doctrees/cpl.database.context.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/cpl.database.doctree
vendored
BIN
docs/build/doctrees/cpl.database.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/environment.pickle
vendored
BIN
docs/build/doctrees/environment.pickle
vendored
Binary file not shown.
20
docs/build/html/cpl.database.connection.html
vendored
20
docs/build/html/cpl.database.connection.html
vendored
@ -192,9 +192,13 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.database.connection.database_connection.DatabaseConnection.connect">
|
||||
<code class="sig-name descname"><span class="pre">connect</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">connection_string</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.database.connection.database_connection.DatabaseConnection.connect" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Connects to a database by connection string
|
||||
:param connection_string:
|
||||
:return:</p>
|
||||
<dd><p>Connects to a database by connection string</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>connection_string: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Database connection string, see: <a class="reference external" href="https://docs.sqlalchemy.org/en/14/core/engines.html">https://docs.sqlalchemy.org/en/14/core/engines.html</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
@ -219,9 +223,13 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.database.connection.database_connection_abc.DatabaseConnectionABC.connect">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">connect</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">connection_string</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.database.connection.database_connection_abc.DatabaseConnectionABC.connect" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Connects to a database by connection string
|
||||
:param connection_string:
|
||||
:return:</p>
|
||||
<dd><p>Connects to a database by connection string</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>connection_string: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Database connection string, see: <a class="reference external" href="https://docs.sqlalchemy.org/en/14/core/engines.html">https://docs.sqlalchemy.org/en/14/core/engines.html</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
|
20
docs/build/html/cpl.database.context.html
vendored
20
docs/build/html/cpl.database.context.html
vendored
@ -192,9 +192,13 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.database.context.database_context.DatabaseContext.connect">
|
||||
<code class="sig-name descname"><span class="pre">connect</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">connection_string</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.database.context.database_context.DatabaseContext.connect" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Connects to a database with connection string
|
||||
:param connection_string:
|
||||
:return:</p>
|
||||
<dd><p>Connects to a database by connection string</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>connection_string: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Database connection string, see: <a class="reference external" href="https://docs.sqlalchemy.org/en/14/core/engines.html">https://docs.sqlalchemy.org/en/14/core/engines.html</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
@ -225,9 +229,13 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.database.context.database_context_abc.DatabaseContextABC.connect">
|
||||
<em class="property"><span class="pre">abstract</span> </em><code class="sig-name descname"><span class="pre">connect</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">connection_string</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.database.context.database_context_abc.DatabaseContextABC.connect" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Connects to a database with connection string
|
||||
:param connection_string:
|
||||
:return:</p>
|
||||
<dd><p>Connects to a database by connection string</p>
|
||||
<blockquote>
|
||||
<div><dl class="simple">
|
||||
<dt>connection_string: <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code></dt><dd><p>Database connection string, see: <a class="reference external" href="https://docs.sqlalchemy.org/en/14/core/engines.html">https://docs.sqlalchemy.org/en/14/core/engines.html</a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div></blockquote>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="py method">
|
||||
|
6
docs/build/html/cpl.database.html
vendored
6
docs/build/html/cpl.database.html
vendored
@ -236,10 +236,8 @@
|
||||
<dl class="py method">
|
||||
<dt id="cpl.database.database_settings.DatabaseSettings.from_dict">
|
||||
<code class="sig-name descname"><span class="pre">from_dict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#cpl.database.database_settings.DatabaseSettings.from_dict" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Converts attributes to dict</p>
|
||||
<blockquote>
|
||||
<div><p>settings: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
|
||||
</div></blockquote>
|
||||
<dd><p>Sets attributes from given dict</p>
|
||||
<p>settings: <code class="xref py py-class docutils literal notranslate"><span class="pre">dict</span></code></p>
|
||||
</dd></dl>
|
||||
|
||||
</dd></dl>
|
||||
|
2
docs/build/html/searchindex.js
vendored
2
docs/build/html/searchindex.js
vendored
File diff suppressed because one or more lines are too long
@ -19,9 +19,11 @@ class DatabaseConnectionABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def connect(self, connection_string: str):
|
||||
"""
|
||||
Connects to a database by connection string
|
||||
:param connection_string:
|
||||
:return:
|
||||
r"""Connects to a database by connection string
|
||||
|
||||
Parameter
|
||||
---------
|
||||
connection_string: :class:`str`
|
||||
Database connection string, see: https://docs.sqlalchemy.org/en/14/core/engines.html
|
||||
"""
|
||||
pass
|
||||
|
@ -20,23 +20,20 @@ class DatabaseContextABC(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def connect(self, connection_string: str):
|
||||
"""
|
||||
Connects to a database with connection string
|
||||
:param connection_string:
|
||||
:return:
|
||||
r"""Connects to a database by connection string
|
||||
|
||||
Parameter
|
||||
---------
|
||||
connection_string: :class:`str`
|
||||
Database connection string, see: https://docs.sqlalchemy.org/en/14/core/engines.html
|
||||
"""
|
||||
pass
|
||||
|
||||
def save_changes(self):
|
||||
"""
|
||||
Saves changes of the database
|
||||
"""
|
||||
r"""Saves changes of the database"""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def _create_tables(self):
|
||||
"""
|
||||
Create all tables for application from database model
|
||||
:return:
|
||||
"""
|
||||
r"""Create all tables for application from database model"""
|
||||
pass
|
||||
|
@ -68,6 +68,12 @@ class DatabaseSettings(ConfigurationModelABC):
|
||||
self._echo = echo
|
||||
|
||||
def from_dict(self, settings: dict):
|
||||
r"""Sets attributes from given dict
|
||||
|
||||
Parameter
|
||||
---------
|
||||
settings: :class:`dict`
|
||||
"""
|
||||
try:
|
||||
self._connection_string = settings[DatabaseSettingsNameEnum.connection_string.value]
|
||||
self._credentials = settings[DatabaseSettingsNameEnum.credentials.value]
|
||||
|
Loading…
Reference in New Issue
Block a user