~ubuntu-branches/debian/sid/sqlalchemy/sid

« back to all changes in this revision

Viewing changes to doc/core/pooling.html

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2014-06-27 20:17:13 UTC
  • mfrom: (1.4.28)
  • Revision ID: package-import@ubuntu.com-20140627201713-g6p1kq8q1qenztrv
Tags: 0.9.6-1
* New upstream release
* Remove Python 3.X build tag files, thanks to Matthias Urlichs for the
  patch (closes: #747852)
* python-fdb isn't in the Debian archive yet so default dialect for firebird://
  URLs is changed to obsolete kinterbasdb, thanks to Russell Stuart for the
  patch (closes: #752145)

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    <script type="text/javascript">
33
33
      var DOCUMENTATION_OPTIONS = {
34
34
          URL_ROOT:    '../',
35
 
          VERSION:     '0.9.4',
 
35
          VERSION:     '0.9.6',
36
36
          COLLAPSE_MODINDEX: false,
37
37
          FILE_SUFFIX: '.html'
38
38
      };
44
44
        <script type="text/javascript" src="../_static/doctools.js"></script>
45
45
    <!-- end iterate through sphinx environment script_files -->
46
46
 
 
47
    <script type="text/javascript" src="../_static/detectmobile.js"></script>
47
48
    <script type="text/javascript" src="../_static/init.js"></script>
48
49
    <link rel="index" title="Index" href="../genindex.html" />
49
50
    <link rel="search" title="Search" href="../search.html" />
69
70
 
70
71
 
71
72
 
 
73
 
72
74
<div id="docs-container">
73
75
 
74
76
 
75
77
 
76
78
 
 
79
 
 
80
<div id="docs-top-navigation-container" class="body-background">
77
81
<div id="docs-header">
 
82
    <div id="docs-version-header">
 
83
        Release: <span class="version-num">0.9.6</span> | Release Date: June 23, 2014
 
84
    </div>
 
85
 
78
86
    <h1>SQLAlchemy 0.9 Documentation</h1>
79
87
 
80
 
    <div id="docs-search">
81
 
    Search:
82
 
    <form class="search" action="../search.html" method="get">
83
 
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
84
 
      <input type="hidden" name="check_keywords" value="yes" />
85
 
      <input type="hidden" name="area" value="default" />
86
 
    </form>
87
 
    </div>
88
 
 
89
 
    <div id="docs-version-header">
90
 
        Release: <span class="version-num">0.9.4</span> | Release Date: March 28, 2014
91
 
 
92
 
 
93
 
    </div>
94
 
 
95
 
</div>
96
 
 
97
 
<div id="docs-top-navigation">
98
 
    <div id="docs-top-page-control" class="docs-navigation-links">
 
88
</div>
 
89
</div>
 
90
 
 
91
<div id="docs-body-container">
 
92
 
 
93
    <div id="fixed-sidebar" class="withsidebar">
 
94
 
 
95
 
 
96
        <div id="docs-sidebar-popout">
 
97
            <h3><a href="../index.html">SQLAlchemy 0.9 Documentation</a></h3>
 
98
 
 
99
            <p id="sidebar-paginate">
 
100
                    <a href="index.html" title="SQLAlchemy Core">Up</a> |
 
101
 
 
102
                    <a href="connections.html" title="Working with Engines and Connections">Prev</a> |
 
103
                    <a href="event.html" title="Events">Next</a>
 
104
            </p>
 
105
 
 
106
            <p id="sidebar-topnav">
 
107
                <a href="../index.html">Contents</a> |
 
108
                <a href="../genindex.html">Index</a>
 
109
            </p>
 
110
 
 
111
            <div id="sidebar-search">
 
112
                <form class="search" action="../search.html" method="get">
 
113
                  <input type="text" name="q" size="12" /> <input type="submit" value="Search" />
 
114
                  <input type="hidden" name="check_keywords" value="yes" />
 
115
                  <input type="hidden" name="area" value="default" />
 
116
                </form>
 
117
            </div>
 
118
 
 
119
        </div>
 
120
 
 
121
        <div id="docs-sidebar">
 
122
 
 
123
        <h3><a href="#">            
 
124
                Connection Pooling
 
125
            
 
126
        </a></h3>
99
127
        <ul>
100
 
            <li>Prev:
101
 
            <a href="connections.html" title="previous chapter">Working with Engines and Connections</a>
102
 
            </li>
103
 
            <li>Next:
104
 
            <a href="event.html" title="next chapter">Events</a>
105
 
            </li>
106
 
 
107
 
        <li>
108
 
            <a href="../contents.html">Table of Contents</a> |
109
 
            <a href="../genindex.html">Index</a>
110
 
            | <a href="../_sources/core/pooling.txt">view source
111
 
        </li>
112
 
        </ul>
113
 
    </div>
114
 
 
115
 
    <div id="docs-navigation-banner">
116
 
        <a href="../index.html">SQLAlchemy 0.9 Documentation</a>
117
 
                » <a href="index.html" title="SQLAlchemy Core">SQLAlchemy Core</a>
118
 
        » 
119
 
                Connection Pooling
120
 
            
121
 
 
122
 
        <h2>
123
 
            
124
 
                Connection Pooling
125
 
            
126
 
        </h2>
127
 
    </div>
128
 
 
129
 
</div>
130
 
 
131
 
<div id="docs-body-container">
132
 
 
133
 
    <div id="docs-sidebar">
134
 
    <h3><a href="../index.html">Table of Contents</a></h3>
135
 
    <ul>
136
128
<li><a class="reference internal" href="#">Connection Pooling</a><ul>
137
129
<li><a class="reference internal" href="#connection-pool-configuration">Connection Pool Configuration</a></li>
138
130
<li><a class="reference internal" href="#switching-pool-implementations">Switching Pool Implementations</a></li>
155
147
</ul>
156
148
 
157
149
 
158
 
    <h4>Previous Topic</h4>
159
 
    <p>
160
 
    <a href="connections.html" title="previous chapter">Working with Engines and Connections</a>
161
 
    </p>
162
 
    <h4>Next Topic</h4>
163
 
    <p>
164
 
    <a href="event.html" title="next chapter">Events</a>
165
 
    </p>
166
 
 
167
 
 
168
 
    <h4>Quick Search</h4>
169
 
    <p>
170
 
    <form class="search" action="../search.html" method="get">
171
 
      <input type="text" name="q" size="18" /> <input type="submit" value="Search" />
172
 
      <input type="hidden" name="check_keywords" value="yes" />
173
 
      <input type="hidden" name="area" value="default" />
174
 
    </form>
175
 
    </p>
 
150
 
 
151
 
 
152
        </div>
176
153
 
177
154
    </div>
178
155
 
 
156
    
 
157
 
179
158
    <div id="docs-body" class="withsidebar" >
180
159
        
181
160
<div class="section" id="module-sqlalchemy.pool">
288
267
<span class="n">cursor</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">&quot;select foo&quot;</span><span class="p">)</span></pre></div>
289
268
</div>
290
269
<p>The purpose of the transparent proxy is to intercept the <tt class="docutils literal"><span class="pre">close()</span></tt> call,
291
 
such that instead of the DBAPI connection being closed, it&#8217;s returned to the
 
270
such that instead of the DBAPI connection being closed, it is returned to the
292
271
pool:</p>
293
272
<div class="highlight-python"><div class="highlight"><pre><span class="c"># &quot;close&quot; the connection.  Returns</span>
294
273
<span class="c"># it to the pool.</span>
378
357
<h3>Disconnect Handling - Pessimistic<a class="headerlink" href="#disconnect-handling-pessimistic" title="Permalink to this headline">¶</a></h3>
379
358
<p>At the expense of some extra SQL emitted for each connection checked out from the pool,
380
359
a &#8220;ping&#8221; operation established by a checkout event handler
381
 
can detect an invalid connection before it&#8217;s used:</p>
 
360
can detect an invalid connection before it is used:</p>
382
361
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">exc</span>
383
362
<span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">event</span>
384
363
<span class="kn">from</span> <span class="nn">sqlalchemy.pool</span> <span class="kn">import</span> <span class="n">Pool</span>