2021.4.4 #30

Merged
edraft merged 15 commits from 2021.4.4 into 2021.4.post1 2021-05-17 18:34:58 +02:00
11 changed files with 51 additions and 32 deletions
Showing only changes of commit e562c31033 - Show all commits

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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">

View File

@ -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">

View File

@ -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>

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -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

View File

@ -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]