Skip to content

Commit adeb07f

Browse files
committed
Release version 2.0.2 of DBUtils
1 parent 1b02c7b commit adeb07f

5 files changed

Lines changed: 42 additions & 24 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ to a database that can be used in all kinds of multi-threaded environments.
77
The suite supports DB-API 2 compliant database interfaces
88
and the classic PyGreSQL interface.
99

10-
The current version 2.0.1 of DBUtils supports Python versions 2.7 and 3.5 to 3.9.
10+
The current version 2.0.2 of DBUtils supports Python versions 2.7 and 3.5 to 3.9.
1111

1212
**Please have a look at the [changelog](https://webwareforpython.github.io/DBUtils/changelog.html), because there are some breaking changes in version 2.0.**
1313

changelog.html

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8"/>
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
6-
<meta name="generator" content="Docutils 0.17: http://docutils.sourceforge.net/" />
6+
<meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
77
<title>Changelog for DBUtils</title>
88
<link rel="stylesheet" href="doc.css" type="text/css" />
99
</head>
@@ -12,14 +12,22 @@
1212
<h1 class="title">Changelog for DBUtils</h1>
1313

1414
<section id="id1">
15+
<h2>2.0.2</h2>
16+
<p>DBUtils 2.0.2 was released on June 8, 2021.</p>
17+
<p>Changes:</p>
18+
<ul class="simple">
19+
<li><p>Allow using context managers for pooled connections.</p></li>
20+
</ul>
21+
</section>
22+
<section id="id2">
1523
<h2>2.0.1</h2>
1624
<p>DBUtils 2.0.1 was released on April 8, 2021.</p>
1725
<p>Changes:</p>
1826
<ul class="simple">
19-
<li><p>Avoid &quot;name Exception is not defined&quot; when exiting</p></li>
27+
<li><p>Avoid &quot;name Exception is not defined&quot; when exiting.</p></li>
2028
</ul>
2129
</section>
22-
<section id="id2">
30+
<section id="id3">
2331
<h2>2.0</h2>
2432
<p>DBUtils 2.0 was released on September 26, 2020.</p>
2533
<p>It is intended to be used with Python versions 2.7 and 3.5 to 3.9.</p>
@@ -35,7 +43,7 @@ <h2>2.0</h2>
3543
<li><p>This changelog has been compiled from the former release notes.</p></li>
3644
</ul>
3745
</section>
38-
<section id="id3">
46+
<section id="id4">
3947
<h2>1.4</h2>
4048
<p>DBUtils 1.4 was released on September 26, 2020.</p>
4149
<p>It is intended to be used with Python versions 2.7 and 3.5 to 3.9.</p>
@@ -46,7 +54,7 @@ <h2>1.4</h2>
4654
inside a transaction.</p></li>
4755
</ul>
4856
</section>
49-
<section id="id4">
57+
<section id="id5">
5058
<h2>1.3</h2>
5159
<p>DBUtils 1.3 was released on March 3, 2018.</p>
5260
<p>It is intended to be used with Python versions 2.6, 2.7 and 3.4 to 3.7.</p>
@@ -55,12 +63,12 @@ <h2>1.3</h2>
5563
<li><p>This version now supports context handlers for connections and cursors.</p></li>
5664
</ul>
5765
</section>
58-
<section id="id5">
66+
<section id="id6">
5967
<h2>1.2</h2>
6068
<p>DBUtils 1.2 was released on February 5, 2017.</p>
6169
<p>It is intended to be used with Python versions 2.6, 2.7 and 3.0 to 3.6.</p>
6270
</section>
63-
<section id="id6">
71+
<section id="id7">
6472
<h2>1.1.1</h2>
6573
<p>DBUtils 1.1.1 was released on February 4, 2017.</p>
6674
<p>It is intended to be used with Python versions 2.3 to 2.7.</p>
@@ -74,7 +82,7 @@ <h2>1.1.1</h2>
7482
<li><p>Fixed a problem when running under Jython (reported by Vitaly Kruglikov).</p></li>
7583
</ul>
7684
</section>
77-
<section id="id7">
85+
<section id="id8">
7886
<h2>1.1</h2>
7987
<p>DBUtils 1.1 was released on August 14, 2011.</p>
8088
<p>Improvements:</p>
@@ -103,7 +111,7 @@ <h2>1.1</h2>
103111
<li><p>Fixed some minor issues with the <span class="docutils literal">DBUtilsExample</span> for Webware.</p></li>
104112
</ul>
105113
</section>
106-
<section id="id8">
114+
<section id="id9">
107115
<h2>1.0</h2>
108116
<p>DBUtils 1.0 was released on November 29, 2008.</p>
109117
<p>It is intended to be used with Python versions 2.2 to 2.6.</p>
@@ -136,7 +144,7 @@ <h2>1.0</h2>
136144
the MySQLdb module (problem reported by Gregory Pinero).</p></li>
137145
</ul>
138146
</section>
139-
<section id="id9">
147+
<section id="id10">
140148
<h2>0.9.4</h2>
141149
<p>DBUtils 0.9.4 was released on July 7, 2007.</p>
142150
<p>This release fixes a problem in the destructor code and has been supplemented
@@ -145,7 +153,7 @@ <h2>0.9.4</h2>
145153
in the last release, since you can now pass custom creator functions
146154
for database connections instead of DB-API 2 modules.</p>
147155
</section>
148-
<section id="id10">
156+
<section id="id11">
149157
<h2>0.9.3</h2>
150158
<p>DBUtils 0.9.3 was released on May 21, 2007.</p>
151159
<p>Changes:</p>
@@ -160,7 +168,7 @@ <h2>0.9.3</h2>
160168
Added Chinese translation of the User's Guide, kindly contributed by gashero.</p></li>
161169
</ul>
162170
</section>
163-
<section id="id11">
171+
<section id="id12">
164172
<h2>0.9.2</h2>
165173
<p>DBUtils 0.9.2 was released on September 22, 2006.</p>
166174
<p>It is intended to be used with Python versions 2.2 to 2.5.</p>
@@ -170,7 +178,7 @@ <h2>0.9.2</h2>
170178
storage engine. Accordingly, renamed <span class="docutils literal">SolidPg</span> to <span class="docutils literal">SteadyPg</span>.</p></li>
171179
</ul>
172180
</section>
173-
<section id="id12">
181+
<section id="id13">
174182
<h2>0.9.1</h2>
175183
<p>DBUtils 0.9.1 was released on May 8, 2006.</p>
176184
<p>It is intended to be used with Python versions 2.2 to 2.4.</p>
@@ -184,7 +192,7 @@ <h2>0.9.1</h2>
184192
<li><p>Improved the documentation and added a User's Guide.</p></li>
185193
</ul>
186194
</section>
187-
<section id="id13">
195+
<section id="id14">
188196
<h2>0.8.1 - 2005-09-13</h2>
189197
<p>DBUtils 0.8.1 was released on September 13, 2005.</p>
190198
<p>It is intended to be used with Python versions 2.0 to 2.4.</p>

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ <h5><a href="changelog.html">Changelog</a></h5>
4242
<header><h2>Downloads</h2></header>
4343
<div>
4444
<h5>Current/Recommended Version:</h5>
45-
<a class="button" href="https://pypi.python.org/pypi/DBUtils/2.0.1/#files">Download <small>DBUtils 2.0.1</small></a>
45+
<a class="button" href="https://pypi.python.org/pypi/DBUtils/2.0.2/#files">Download <small>DBUtils 2.0.2</small></a>
4646
<p><small>(this version supports Python 2.7 and 3.5 to 3.9)</small></p>
4747
</div>
4848
<div>

main.de.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8"/>
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
6-
<meta name="generator" content="Docutils 0.17: http://docutils.sourceforge.net/" />
6+
<meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
77
<title>Benutzeranleitung für DBUtils</title>
88
<link rel="stylesheet" href="doc.css" type="text/css" />
99
</head>
@@ -12,7 +12,7 @@
1212
<h1 class="title">Benutzeranleitung für DBUtils</h1>
1313
<dl class="docinfo simple">
1414
<dt class="version">Version</dt>
15-
<dd class="version">2.0.1</dd>
15+
<dd class="version">2.0.2</dd>
1616
<dt class="translations">Translations</dt>
1717
<dd class="translations"><p><a class="reference external" href="main.html">English</a> | German</p>
1818
</dd>
@@ -328,7 +328,7 @@ <h3>PersistentDB (persistent_db)</h3>
328328
endet. Sie können dieses Verhalten ändern, indem Sie den Parameter namens
329329
<span class="docutils literal">closeable</span> setzen.</p>
330330
<p>Bitte beachten Sie, dass Transaktionen explizit durch Aufruf der Methode
331-
<span class="docutils literal">begin()</span> eingeleiten werden müssen. Hierdurch wird sichergestellt, dass
331+
<span class="docutils literal">begin()</span> eingeleitet werden müssen. Hierdurch wird sichergestellt, dass
332332
das transparente Neueröffnen von Verbindungen bis zum Ende der Transaktion
333333
ausgesetzt wird, und dass die Verbindung zurückgerollt wird, before sie vom
334334
gleichen Thread erneut benutzt wird.</p>
@@ -428,8 +428,13 @@ <h3>PooledDB (pooled_db)</h3>
428428
res = cur.fetchone()
429429
cur.close() # oder del cur
430430
db.close() # oder del db</pre>
431+
<p>Sie können dies auch durch Verwendung von Kontext-Managern vereinfachen:</p>
432+
<pre class="literal-block">with pool.connection() as db:
433+
with db.cursor as cur:
434+
cur.execute(...)
435+
res = cur.fetchone()</pre>
431436
<p>Bitte beachten Sie, dass Transaktionen explizit durch Aufruf der Methode
432-
<span class="docutils literal">begin()</span> eingeleiten werden müssen. Hierdurch wird sichergestellt,
437+
<span class="docutils literal">begin()</span> eingeleitet werden müssen. Hierdurch wird sichergestellt,
433438
dass die Verbindung nicht mehr mit anderen Threads geteilt wird, dass das
434439
transparente Neueröffnen von Verbindungen bis zum Ende der Transaktion
435440
ausgesetzt wird, und dass die Verbindung zurückgerollt wird, bevor sie
@@ -447,7 +452,7 @@ <h2>Anmerkungen</h2>
447452
oder <a class="reference external" href="https://github.com/GrahamDumpleton/mod_wsgi">mod_wsgi</a>, dann sollten Sie bedenken, dass Ihr Python-Code normalerweise
448453
im Kontext der Kindprozesse des Webservers läuft. Wenn Sie also das
449454
<span class="docutils literal">pooled_db</span>-Modul einsetzen, und mehrere dieser Kindprozesse laufen, dann
450-
werden Sie ebensoviele Pools mit Datenbankverbindungen erhalten. Wenn diese
455+
werden Sie ebenso viele Pools mit Datenbankverbindungen erhalten. Wenn diese
451456
Prozesse viele Threads laufen lassen, dann mag dies eine sinnvoller Ansatz
452457
sein, wenn aber diese Prozesse nicht mehr als einen Worker-Thread starten,
453458
wie im Fall des Multi-Processing Moduls &quot;prefork&quot; für den Apache-Webserver,

main.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8"/>
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
6-
<meta name="generator" content="Docutils 0.17: http://docutils.sourceforge.net/" />
6+
<meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
77
<title>DBUtils User's Guide</title>
88
<link rel="stylesheet" href="doc.css" type="text/css" />
99
</head>
@@ -12,7 +12,7 @@
1212
<h1 class="title">DBUtils User's Guide</h1>
1313
<dl class="docinfo simple">
1414
<dt class="version">Version</dt>
15-
<dd class="version">2.0.1</dd>
15+
<dd class="version">2.0.2</dd>
1616
<dt class="translations">Translations</dt>
1717
<dd class="translations"><p>English | <a class="reference external" href="main.de.html">German</a></p>
1818
</dd>
@@ -303,7 +303,7 @@ <h3>PersistentDB (persistent_db)</h3>
303303
ignored since it would be reopened at the next usage anyway and
304304
contrary to the intent of having persistent connections. Instead,
305305
the connection will be automatically closed when the thread dies.
306-
You can change this behavior be setting the <span class="docutils literal">closeable</span> parameter.</p>
306+
You can change this behavior by setting the <span class="docutils literal">closeable</span> parameter.</p>
307307
<p>Note that you need to explicitly start transactions by calling the
308308
<span class="docutils literal">begin()</span> method. This ensures that the transparent reopening will be
309309
suspended until the end of the transaction, and that the connection
@@ -390,6 +390,11 @@ <h3>PooledDB (pooled_db)</h3>
390390
res = cur.fetchone()
391391
cur.close() # or del cur
392392
db.close() # or del db</pre>
393+
<p>You can also use context managers for simpler code:</p>
394+
<pre class="literal-block">with pool.connection() as db:
395+
with db.cursor as cur:
396+
cur.execute(...)
397+
res = cur.fetchone()</pre>
393398
<p>Note that you need to explicitly start transactions by calling the
394399
<span class="docutils literal">begin()</span> method. This ensures that the connection will not be shared
395400
with other threads, that the transparent reopening will be suspended

0 commit comments

Comments
 (0)