Skip to content

Commit

Permalink
更改默认postgres的数据库被过滤的逻辑 (hhyo#1905)
Browse files Browse the repository at this point in the history
* 更改默认postgres的数据库被过滤的逻辑

Co-authored-by: hhyo <rtttte@qq.com>
(cherry picked from commit a094a7c)
  • Loading branch information
chenyu1st authored and nick2wang committed Nov 8, 2022
1 parent b452679 commit 80f8846
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions sql/engines/pgsql.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: UTF-8 -*-
"""
"""
@author: hhyo、yyukai
@license: Apache Licence
@file: pgsql.py
Expand Down Expand Up @@ -55,9 +55,7 @@ def get_all_databases(self):
"""
result = self.query(sql=f"SELECT datname FROM pg_database;")
db_list = [
row[0]
for row in result.rows
if row[0] not in ["postgres", "template0", "template1"]
row[0] for row in result.rows if row[0] not in ["template0", "template1"]
]
result.rows = db_list
return result
Expand Down Expand Up @@ -93,8 +91,8 @@ def get_all_tables(self, db_name, **kwargs):
:return:
"""
schema_name = kwargs.get("schema_name")
sql = f"""SELECT table_name
FROM information_schema.tables
sql = f"""SELECT table_name
FROM information_schema.tables
where table_schema ='{schema_name}';"""
result = self.query(db_name=db_name, sql=sql)
tb_list = [row[0] for row in result.rows if row[0] not in ["test"]]
Expand All @@ -111,7 +109,7 @@ def get_all_columns_by_tb(self, db_name, tb_name, **kwargs):
"""
schema_name = kwargs.get("schema_name")
sql = f"""SELECT column_name
FROM information_schema.columns
FROM information_schema.columns
where table_name='{tb_name}'
and table_schema ='{schema_name}';"""
result = self.query(db_name=db_name, sql=sql)
Expand Down

0 comments on commit 80f8846

Please sign in to comment.