Skip to content

Commit

Permalink
issue-1032/oracle查看表结构增加注释列
Browse files Browse the repository at this point in the history
  • Loading branch information
unknowissue committed Jan 8, 2022
1 parent 42e1d12 commit 622e726
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions sql/engines/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,17 @@ def describe_table(self, db_name, tb_name, **kwargs):
"""return ResultSet"""
# https://www.thepolyglotdeveloper.com/2015/01/find-tables-oracle-database-column-name/
sql = f"""SELECT
column_name,
a.column_name,
data_type,
data_length,
nullable,
data_default
FROM all_tab_cols
WHERE table_name = '{tb_name}' and owner = '{db_name}' order by column_id
data_default,
b.comments
FROM all_tab_cols a, all_col_comments b
WHERE a.table_name = b.table_name
and a.owner = b.OWNER
and a.COLUMN_NAME = b.COLUMN_NAME
and a.table_name = '{tb_name}' and a.owner = '{db_name}' order by column_id
"""
result = self.query(db_name=db_name, sql=sql)
return result
Expand Down

0 comments on commit 622e726

Please sign in to comment.