Browse Source

SQLite

pull/140/head
Jure Šorn 1 year ago
parent
commit
a8b066b554
2 changed files with 2 additions and 2 deletions
  1. 2
      README.md
  2. 2
      index.html

2
README.md

@ -1923,7 +1923,7 @@ with <conn>: # Exits the block with commit()
```python
# $ pip3 install sqlalchemy
from sqlalchemy import create_engine, text
<engine> = create_engine('<url>').connect() # Url: 'dialect://user:password@host/dbname'.
<engine> = create_engine('<url>') # Url: 'dialect://user:password@host/dbname'.
<conn> = <engine>.connect() # Creates a connection. Also <conn>.close().
<cursor> = <conn>.execute(text('<query>'), …) # Replaces ':<key>'s with keyword arguments.
with <conn>.begin(): ... # Exits the block with commit or rollback.

2
index.html

@ -1600,7 +1600,7 @@ CompletedProcess(args=[<span class="hljs-string">'bc'</span>, <span class="hljs-
<div><h3 id="sqlalchemy">SqlAlchemy</h3><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install sqlalchemy</span>
<span class="hljs-keyword">from</span> sqlalchemy <span class="hljs-keyword">import</span> create_engine, text
&lt;engine&gt; = create_engine(<span class="hljs-string">'&lt;url&gt;'</span>).connect() <span class="hljs-comment"># Url: 'dialect://user:password@host/dbname'.</span>
&lt;engine&gt; = create_engine(<span class="hljs-string">'&lt;url&gt;'</span>) <span class="hljs-comment"># Url: 'dialect://user:password@host/dbname'.</span>
&lt;conn&gt; = &lt;engine&gt;.connect() <span class="hljs-comment"># Creates a connection. Also &lt;conn&gt;.close().</span>
&lt;cursor&gt; = &lt;conn&gt;.execute(text(<span class="hljs-string">'&lt;query&gt;'</span>), …) <span class="hljs-comment"># Replaces ':&lt;key&gt;'s with keyword arguments.</span>
<span class="hljs-keyword">with</span> &lt;conn&gt;.begin(): ... <span class="hljs-comment"># Exits the block with commit or rollback.</span>

Loading…
Cancel
Save