mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-06 10:54:29 +00:00
fix: add error message log out
This commit is contained in:
parent
eee2072acf
commit
6a03c24ee7
@ -60,10 +60,14 @@ class PostgreSQLDatabase(RDBMSDatabase):
|
|||||||
|
|
||||||
def get_collation(self):
|
def get_collation(self):
|
||||||
"""Get collation."""
|
"""Get collation."""
|
||||||
|
try:
|
||||||
session = self._db_sessions()
|
session = self._db_sessions()
|
||||||
cursor = session.execute(text("SELECT datcollate AS collation FROM pg_database WHERE datname = current_database();"))
|
cursor = session.execute(text("SELECT datcollate AS collation FROM pg_database WHERE datname = current_database();"))
|
||||||
collation = cursor.fetchone()[0]
|
collation = cursor.fetchone()[0]
|
||||||
return collation
|
return collation
|
||||||
|
except Exception as e:
|
||||||
|
print("postgresql get collation error: ", e)
|
||||||
|
return None
|
||||||
|
|
||||||
def get_users(self):
|
def get_users(self):
|
||||||
"""Get user info."""
|
"""Get user info."""
|
||||||
@ -72,6 +76,7 @@ class PostgreSQLDatabase(RDBMSDatabase):
|
|||||||
users = cursor.fetchall()
|
users = cursor.fetchall()
|
||||||
return [user[0] for user in users]
|
return [user[0] for user in users]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
print("postgresql get users error: ", e)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_fields(self, table_name):
|
def get_fields(self, table_name):
|
||||||
|
Loading…
Reference in New Issue
Block a user