/usr/share/doc/python3-postgresql/html/index.html is in python3-postgresql 1.1.0-2build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>py-postgresql — py-postgresql 1.1.0 documentation</title>
<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '1.1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="py-postgresql 1.1.0 documentation" href="#" />
<link rel="next" title="Administration" href="admin.html" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
<link rel="stylesheet" href="_static/unsuck.css" type="text/css" />
</head>
<body role="document">
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="py-postgresql">
<h1>py-postgresql<a class="headerlink" href="#py-postgresql" title="Permalink to this headline">¶</a></h1>
<p>py-postgresql is a project dedicated to improving the Python client interfaces to PostgreSQL.</p>
<p>At its core, py-postgresql provides a PG-API, <cite>postgresql.api</cite>, and
DB-API 2.0 interface for using a PostgreSQL database.</p>
<div class="section" id="contents">
<h2>Contents<a class="headerlink" href="#contents" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="admin.html">Administration</a><ul>
<li class="toctree-l2"><a class="reference internal" href="admin.html#installation">Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="admin.html#environment">Environment</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="driver.html">Driver</a><ul>
<li class="toctree-l2"><a class="reference internal" href="driver.html#establishing-a-connection">Establishing a Connection</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#connections">Connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#prepared-statements">Prepared Statements</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#cursors">Cursors</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#rows">Rows</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#queries">Queries</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#stored-procedures">Stored Procedures</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#transactions">Transactions</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#settings">Settings</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#type-support">Type Support</a></li>
<li class="toctree-l2"><a class="reference internal" href="driver.html#database-messages">Database Messages</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="copyman.html">Copy Management</a><ul>
<li class="toctree-l2"><a class="reference internal" href="copyman.html#copy-managers">Copy Managers</a></li>
<li class="toctree-l2"><a class="reference internal" href="copyman.html#faults">Faults</a></li>
<li class="toctree-l2"><a class="reference internal" href="copyman.html#failures">Failures</a></li>
<li class="toctree-l2"><a class="reference internal" href="copyman.html#producers">Producers</a></li>
<li class="toctree-l2"><a class="reference internal" href="copyman.html#receivers">Receivers</a></li>
<li class="toctree-l2"><a class="reference internal" href="copyman.html#terminology">Terminology</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="notifyman.html">Notification Management</a><ul>
<li class="toctree-l2"><a class="reference internal" href="notifyman.html#listening-on-a-single-connection">Listening on a Single Connection</a></li>
<li class="toctree-l2"><a class="reference internal" href="notifyman.html#listening-on-multiple-connections">Listening on Multiple Connections</a></li>
<li class="toctree-l2"><a class="reference internal" href="notifyman.html#notification-managers">Notification Managers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="alock.html">Advisory Locks</a><ul>
<li class="toctree-l2"><a class="reference internal" href="alock.html#acquiring-alocks">Acquiring ALocks</a></li>
<li class="toctree-l2"><a class="reference internal" href="alock.html#alocks">ALocks</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="cluster.html">Cluster Management</a><ul>
<li class="toctree-l2"><a class="reference internal" href="cluster.html#installations">Installations</a></li>
<li class="toctree-l2"><a class="reference internal" href="cluster.html#clusters">Clusters</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="lib.html">Categories and Libraries</a><ul>
<li class="toctree-l2"><a class="reference internal" href="lib.html#writing-libraries">Writing Libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="lib.html#using-libraries">Using Libraries</a></li>
<li class="toctree-l2"><a class="reference internal" href="lib.html#symbol-types">Symbol Types</a></li>
<li class="toctree-l2"><a class="reference internal" href="lib.html#symbol-execution-methods">Symbol Execution Methods</a></li>
<li class="toctree-l2"><a class="reference internal" href="lib.html#reference-symbols">Reference Symbols</a></li>
<li class="toctree-l2"><a class="reference internal" href="lib.html#distributing-and-usage">Distributing and Usage</a></li>
<li class="toctree-l2"><a class="reference internal" href="lib.html#audience-and-motivation">Audience and Motivation</a></li>
<li class="toctree-l2"><a class="reference internal" href="lib.html#terminology">Terminology</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="clientparameters.html">Client Parameters</a><ul>
<li class="toctree-l2"><a class="reference internal" href="clientparameters.html#collecting-parameters">Collecting Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="clientparameters.html#defaults">Defaults</a></li>
<li class="toctree-l2"><a class="reference internal" href="clientparameters.html#postgresql-environment-variables">PostgreSQL Environment Variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="clientparameters.html#postgresql-password-file">PostgreSQL Password File</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="gotchas.html">Gotchas</a><ul>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#non-english-locales">Non-English Locales</a></li>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#thread-safety">Thread Safety</a></li>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#client-encoding-setting-should-be-altered-carefully"><cite>client_encoding</cite> setting should be altered carefully</a></li>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#the-user-and-password-is-correct-but-it-does-not-work-when-using-postgresql-driver">The user and password is correct, but it does not work when using <cite>postgresql.driver</cite></a></li>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#backslash-characters-are-being-treated-literally">Backslash characters are being treated literally</a></li>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#types-without-binary-support-in-the-driver-are-unsupported-in-arrays-and-records">Types without binary support in the driver are unsupported in arrays and records</a></li>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#notices-warnings-and-other-messages-are-too-verbose">NOTICEs, WARNINGs, and other messages are too verbose</a></li>
<li class="toctree-l2"><a class="reference internal" href="gotchas.html#strange-typeerror-using-load-rows-or-load-chunks">Strange TypeError using load_rows() or load_chunks()</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="reference">
<h2>Reference<a class="headerlink" href="#reference" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="bin.html">Commands</a><ul>
<li class="toctree-l2"><a class="reference internal" href="bin.html#postgresql-bin-pg-python">postgresql.bin.pg_python</a></li>
<li class="toctree-l2"><a class="reference internal" href="bin.html#postgresql-bin-pg-dotconf">postgresql.bin.pg_dotconf</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="reference.html">Reference</a><ul>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql"><code class="docutils literal"><span class="pre">postgresql</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.api"><code class="docutils literal"><span class="pre">postgresql.api</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.sys"><code class="docutils literal"><span class="pre">postgresql.sys</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.string"><code class="docutils literal"><span class="pre">postgresql.string</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.exceptions"><code class="docutils literal"><span class="pre">postgresql.exceptions</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.temporal"><code class="docutils literal"><span class="pre">postgresql.temporal</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.installation"><code class="docutils literal"><span class="pre">postgresql.installation</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.cluster"><code class="docutils literal"><span class="pre">postgresql.cluster</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.copyman"><code class="docutils literal"><span class="pre">postgresql.copyman</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="reference.html#module-postgresql.alock"><code class="docutils literal"><span class="pre">postgresql.alock</span></code></a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="changes">
<h2>Changes<a class="headerlink" href="#changes" title="Permalink to this headline">¶</a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="changes-v1.1.html">Changes in v1.1</a></li>
<li class="toctree-l1"><a class="reference internal" href="changes-v1.0.html">Changes in v1.0</a></li>
</ul>
</div>
</div>
<div class="section" id="sample-code">
<h2>Sample Code<a class="headerlink" href="#sample-code" title="Permalink to this headline">¶</a></h2>
<p>Using <cite>postgresql.driver</cite>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">postgresql</span>
<span class="gp">>>> </span><span class="n">db</span> <span class="o">=</span> <span class="n">postgresql</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="s">"pq://user:password@host/name_of_database"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">db</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="s">"CREATE TABLE emp (emp_name text PRIMARY KEY, emp_salary numeric)"</span><span class="p">)</span>
<span class="go">>>></span>
<span class="gp">>>> </span><span class="c"># Create the statements.</span>
<span class="gp">>>> </span><span class="n">make_emp</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">prepare</span><span class="p">(</span><span class="s">"INSERT INTO emp VALUES ($1, $2)"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">raise_emp</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">prepare</span><span class="p">(</span><span class="s">"UPDATE emp SET emp_salary = emp_salary + $2 WHERE emp_name = $1"</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">get_emp_with_salary_lt</span> <span class="o">=</span> <span class="n">db</span><span class="o">.</span><span class="n">prepare</span><span class="p">(</span><span class="s">"SELECT emp_name FROM emp WHERE emp_salay < $1"</span><span class="p">)</span>
<span class="go">>>></span>
<span class="gp">>>> </span><span class="c"># Create some employees, but do it in a transaction--all or nothing.</span>
<span class="gp">>>> </span><span class="k">with</span> <span class="n">db</span><span class="o">.</span><span class="n">xact</span><span class="p">():</span>
<span class="gp">... </span> <span class="n">make_emp</span><span class="p">(</span><span class="s">"John Doe"</span><span class="p">,</span> <span class="s">"150,000"</span><span class="p">)</span>
<span class="gp">... </span> <span class="n">make_emp</span><span class="p">(</span><span class="s">"Jane Doe"</span><span class="p">,</span> <span class="s">"150,000"</span><span class="p">)</span>
<span class="gp">... </span> <span class="n">make_emp</span><span class="p">(</span><span class="s">"Andrew Doe"</span><span class="p">,</span> <span class="s">"55,000"</span><span class="p">)</span>
<span class="gp">... </span> <span class="n">make_emp</span><span class="p">(</span><span class="s">"Susan Doe"</span><span class="p">,</span> <span class="s">"60,000"</span><span class="p">)</span>
<span class="go">>>></span>
<span class="gp">>>> </span><span class="c"># Give some raises</span>
<span class="gp">>>> </span><span class="k">with</span> <span class="n">db</span><span class="o">.</span><span class="n">xact</span><span class="p">():</span>
<span class="gp">... </span> <span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">get_emp_with_salary_lt</span><span class="p">(</span><span class="s">"125,000"</span><span class="p">):</span>
<span class="gp">... </span> <span class="k">print</span><span class="p">(</span><span class="n">row</span><span class="p">[</span><span class="s">"emp_name"</span><span class="p">])</span>
<span class="gp">... </span> <span class="n">raise_emp</span><span class="p">(</span><span class="n">row</span><span class="p">[</span><span class="s">"emp_name"</span><span class="p">],</span> <span class="s">"10,000"</span><span class="p">)</span>
</pre></div>
</div>
<p>Of course, if DB-API 2.0 is desired, the module is located at
<cite>postgresql.driver.dbapi20</cite>. DB-API extends PG-API, so the features
illustrated above are available on DB-API connections.</p>
<p>See <a class="reference internal" href="driver.html#db-interface"><span>Driver</span></a> for more information.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="#">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">py-postgresql</a><ul>
<li><a class="reference internal" href="#contents">Contents</a></li>
<li><a class="reference internal" href="#reference">Reference</a></li>
<li><a class="reference internal" href="#changes">Changes</a></li>
<li><a class="reference internal" href="#sample-code">Sample Code</a></li>
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="#">Documentation overview</a><ul>
<li>Next: <a href="admin.html" title="next chapter">Administration</a></li>
</ul></li>
</ul>
</div>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/index.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©Python+Postgres.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.3.4</a>
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.6</a>
|
<a href="_sources/index.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>
|