xnuinside / simple-ddl-parser

Simple DDL Parser to parse SQL (HQL, TSQL, AWS Redshift, BigQuery, Snowflake and other dialects) ddl files to json/python dict with full information about columns: types, defaults, primary keys, etc. & table properties, types, domains, etc.
MIT License
175 stars 40 forks source link

Using Postgres type `timestamp with time zone` results to table not appearing in the list #250

Closed umaxfun closed 2 months ago

umaxfun commented 2 months ago

The code

from simple_ddl_parser import ddl_parser

sql = "CREATE TABLE public.test (date_updated timestamp with time zone);"
result = ddl_parser.DDLParser(sql).run()
print(result)

results in []

This type is used by Directus CMS, so I can't use another type =(

xnuinside commented 2 months ago

@umaxfun Hi! Thanks for opening the issue. I released the fix in version 1.3.0 - https://pypi.org/project/simple-ddl-parser/. Test was added: https://github.com/xnuinside/simple-ddl-parser/blob/main/tests/dialects/test_psql.py#L118 If will be needed anything else - feel free to open new issue!

umaxfun commented 2 months ago

Wow, so cool, thanks a lot!