Popular recipes tagged "postgresql"http://code.activestate.com/recipes/tags/postgresql/2014-02-21T09:17:23-08:00ActiveState Code RecipesPostgreSQL database backup script (Python) 2011-07-15T08:27:05-07:00Evgeniy.Khttp://code.activestate.com/recipes/users/4178635/http://code.activestate.com/recipes/577793-postgresql-database-backup-script/ <p style="color: grey"> Python recipe 577793 by <a href="/recipes/users/4178635/">Evgeniy.K</a> (<a href="/recipes/tags/backup/">backup</a>, <a href="/recipes/tags/linux/">linux</a>, <a href="/recipes/tags/postgresql/">postgresql</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/unix/">unix</a>). </p> <p>Simple script to backup some databases from PostgreSQL on unix\linux.</p> Minimalistic 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> Transparently execute SQL queries as prepared statements with Postgresql (Python) 2009-03-23T07:30:07-07:00Michael Palmerhttp://code.activestate.com/recipes/users/1827292/http://code.activestate.com/recipes/576698-transparently-execute-sql-queries-as-prepared-stat/ <p style="color: grey"> Python recipe 576698 by <a href="/recipes/users/1827292/">Michael Palmer</a> (<a href="/recipes/tags/postgresql/">postgresql</a>, <a href="/recipes/tags/prepared_statements/">prepared_statements</a>, <a href="/recipes/tags/sql/">sql</a>). Revision 4. </p> <p>This recipe defines a mixin class for DBAPI cursors that gives them an 'executeps' method. This method transparently converts any SQL query into a prepared statement, which gets cached and executed instead of the original query.</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>