Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue-1032/oracle查看表结构增加注释列 #1320

Merged
merged 1 commit into from
Jan 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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