Skip to content

Instantly share code, notes, and snippets.

@peterbe
Created February 14, 2014 17:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterbe/9004829 to your computer and use it in GitHub Desktop.
Save peterbe/9004829 to your computer and use it in GitHub Desktop.
import psycopg2
import os, sys
import csv
import code
queryfile = sys.argv[1]
args = sys.argv[2:]
query = open(queryfile).read()
connectionstring = open(os.path.expanduser('~/socorro.connection'), 'r').read().strip()
conn = psycopg2.connect(connectionstring)
cur = conn.cursor()
print "Connection available as `conn`"
print "Cursor available as `cur`"
code.interact(local=locals())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment