Permalink
Browse files

Adding support for specifying a schema search path when running pwiz,

thanks @redapple for the suggestion
  • Loading branch information...
1 parent feaef8a commit 963cfe41c9af773be934e36fb5e3a17eaeb85ff6 @coleifer committed May 22, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 pwiz.py
View
@@ -257,8 +257,12 @@ def get_db(engine):
def introspect(engine, database, **connect):
db = get_db(engine)
+ schema = connect.pop('schema', None)
db.connect(database, **connect)
+ if schema:
+ db.conn.set_search_path(*schema.split(','))
+
tables = db.get_tables()
models = {}
@@ -336,9 +340,10 @@ def err(msg):
ao('-u', '--user', dest='user')
ao('-P', '--password', dest='password')
ao('-e', '--engine', dest='engine', default='postgresql')
+ ao('-s', '--schema', dest='schema')
options, args = parser.parse_args()
- ops = ('host', 'port', 'user', 'password')
+ ops = ('host', 'port', 'user', 'password', 'schema')
connect = dict((o, getattr(options, o)) for o in ops if getattr(options, o))
if len(args) < 1:

0 comments on commit 963cfe4

Please sign in to comment.