sql-metadata icon indicating copy to clipboard operation
sql-metadata copied to clipboard

The project cannot parse the CREATE TEMPORARY statement.

Open ZC-TZ opened this issue 1 year ago • 0 comments

sql = "create temporary table M_ZJM_qy2 DISTRIBUTED BY('B_dkhth') select B_dkhth,B_khh,CONCAT(F,F_jjbh,F_bz,F_jjje,F_jjye,F_fkrq,F_fkdqr,rtrim(F_dkywzl),F_dkxs,F_dkxz,F_dktx,F_dkzl,F_zqbz,F_sjfl,F_wjfl) F from m_zjm_dkywxx_f where beiz = '' and B_dkhth <> '' and B_dkhth = any(select B_dkhth from M_ZJM_qy1)"

# use SQL Metadata Parser
parser = Parser(sql)

print("Tables:", parser.tables)  # get Tables
print("Columns:", parser.columns)  # get Columns
print("Tokens:", parser.tokens)  # get Tokens

When running the above statement, an error will occur: ValueError: Not supported query type!

I think this error is caused by the CREATE TEMPORARY keyword. When only using CREATE, the error does not occur.

ZC-TZ avatar Dec 23 '24 02:12 ZC-TZ