mirror of https://github.com/dbcli/pgcli
Fix a bug in postgres connection string.
This commit is contained in:
parent
36cd848cad
commit
b03973782a
2
TODO
2
TODO
|
@ -1,4 +1,3 @@
|
|||
* [] postgres:// url is failing.
|
||||
* [] Meta-enter to end the line not just semi-colon.
|
||||
* [] Cmd-K breaks in OS X.
|
||||
* [] Typing mid stream doesn't complete, only end of line is auto-completed.
|
||||
|
@ -21,6 +20,7 @@
|
|||
* [ ] Detect a '.' and parse the word before it and get it's real name.
|
||||
* [] Refactor the execution and output into a separate class.
|
||||
* [] Create a class for the config and make it easy to access.
|
||||
* [X] postgres:// url is failing.
|
||||
* [X] Implement \l, show databases
|
||||
* [X] DESCRIBE is also not listed in the autocompletion.
|
||||
* [X] Add MySQL commands (use, describe etc)
|
||||
|
|
|
@ -49,11 +49,12 @@ class PGExecute(object):
|
|||
databases_query = '''SELECT datname FROM pg_database;'''
|
||||
|
||||
def __init__(self, database, user, password, host, port):
|
||||
self.conn = psycopg2.connect(database)
|
||||
(self.dbname, self.user, self.password, self.host, self.port) = \
|
||||
_parse_dsn(database, default_user=user,
|
||||
default_password=password, default_host=host,
|
||||
default_port=port)
|
||||
self.conn = psycopg2.connect(database=self.dbname, user=self.user,
|
||||
password=self.password, host=self.host, port=self.port)
|
||||
self.conn.autocommit = True
|
||||
|
||||
def run(self, sql):
|
||||
|
@ -114,11 +115,3 @@ class PGExecute(object):
|
|||
with self.conn.cursor() as cur:
|
||||
cur.execute(self.databases_query)
|
||||
return [x[0] for x in cur.fetchall()]
|
||||
|
||||
#def _meta_execute(self, sql, query_params=()):
|
||||
#with self.conn.cursor() as cur:
|
||||
#if query_params:
|
||||
#cur.execute(sql, query_params)
|
||||
#else:
|
||||
#cur.execute(sql)
|
||||
#return [x[0] for x in cur.fetchall()]
|
||||
|
|
Loading…
Reference in New Issue