Top-rated recipes tagged "postgres"http://code.activestate.com/recipes/tags/postgres/top/2014-02-21T09:17:23-08:00ActiveState Code RecipesMinimalistic PostgreSQL console shell (Python) 2011-11-30T13:43:28-08:00ccpizzahttp://code.activestate.com/recipes/users/4170754/http://code.activestate.com/recipes/577468-minimalistic-postgresql-console-shell/ <p style="color: grey"> Python recipe 577468 by <a href="/recipes/users/4170754/">ccpizza</a> (<a href="/recipes/tags/postgres/">postgres</a>, <a href="/recipes/tags/postgresql/">postgresql</a>, <a href="/recipes/tags/sql/">sql</a>). Revision 17. </p> <p>Primitive shell for running PostgreSQL quieries from console. Make sure you set the right connection settings in the script.</p> <p>All queries are executed in autocommit mode.</p> <p>Example command line usage:</p> <pre class="prettyprint"><code>pg.py select * from mytable where oidh=1 </code></pre> <p>The script recognizes a number of magic keywords:</p> <pre class="prettyprint"><code>pg.py show databases pg.py show schemas pg.py describe &lt;table_name&gt; </code></pre> Global database configuration and context aware connection pool extention for psycopg2 (Python) 2010-02-26T02:57:49-08:00Valentine Gogichashvilihttp://code.activestate.com/recipes/users/4172185/http://code.activestate.com/recipes/577072-global-database-configuration-and-context-aware-co/ <p style="color: grey"> Python recipe 577072 by <a href="/recipes/users/4172185/">Valentine Gogichashvili</a> (<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/postgres/">postgres</a>). Revision 2. </p> <p>This extention makes it possible to hold a global configuration of all needed database, and access this databases using a special context aware named connection pools. The context can help to automate transaction commits and rollbacks and return special connection cursors in the context. See module and class docs for more information.</p> Dump PostgreSQL db schema to text (Python) 2014-02-21T09:17:23-08:00Michal Niklashttp://code.activestate.com/recipes/users/186902/http://code.activestate.com/recipes/576557-dump-postgresql-db-schema-to-text/ <p style="color: grey"> Python recipe 576557 by <a href="/recipes/users/186902/">Michal Niklas</a> (<a href="/recipes/tags/database/">database</a>, <a href="/recipes/tags/postgres/">postgres</a>, <a href="/recipes/tags/postgresql/">postgresql</a>, <a href="/recipes/tags/schema/">schema</a>). Revision 7. </p> <p>With PostgreSQL there is:</p> <pre class="prettyprint"><code>pg_dump --schema_only </code></pre> <p>but I wanted to compare my PostgreSQL and Oracle database schema dumped by: <a href="http://code.activestate.com/recipes/576534/">http://code.activestate.com/recipes/576534/</a></p>