|
@@ -82,11 +82,14 @@ class PostgreSQLClient(BaseRDMSClient):
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_databases(self):
|
|
def get_databases(self):
|
|
|
- return [self._conn_params['database']]
|
|
|
|
|
|
|
+ # List all the schemas in the database
|
|
|
|
|
+ cursor = self.connection.cursor()
|
|
|
|
|
+ cursor.execute('SELECT schema_name FROM information_schema.schemata')
|
|
|
|
|
+ self.connection.commit()
|
|
|
|
|
+ return [row[0] for row in cursor.fetchall()]
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_tables(self, database, table_names=[]):
|
|
def get_tables(self, database, table_names=[]):
|
|
|
- # Doesn't use database and only retrieves tables for database currently in use.
|
|
|
|
|
cursor = self.connection.cursor()
|
|
cursor = self.connection.cursor()
|
|
|
cursor.execute("SELECT table_name FROM information_schema.tables WHERE table_schema='%s'" % database)
|
|
cursor.execute("SELECT table_name FROM information_schema.tables WHERE table_schema='%s'" % database)
|
|
|
self.connection.commit()
|
|
self.connection.commit()
|