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
179 stars 40 forks source link

Add support for INHERITS in postgres dialect #191

Closed ahaessly closed 1 year ago

ahaessly commented 1 year ago

Is your feature request related to a problem? Please describe. I use INHERITS in my postgres schema. The parser does not recognize create table statements that use INHERITS

Describe the solution you'd like Create entries for tables that use INHERITS with their inherited fields

Describe alternatives you've considered Currently I have to manually edit my ddl for any tables that use INHERITS

Additional context

CREATE TABLE public.identifier (
    system text NOT NULL,
    value text NOT NULL
);

CREATE TABLE public."Diagnosis" (
    id text NOT NULL,
);

CREATE TABLE public."Diagnosis_identifier" (
    "Diagnosis_id" text NOT NULL
)
INHERITS (public.identifier);

resulting file does not include a table for Diagnosis_identifier

xnuinside commented 1 year ago

@ahaessly Thanks for reporting the issue! Sorry for the delay with answer, I had a lot of personal things to do. I added support for INHERITS. It will be available in 0.30.0 version - I will add one more comment when I will release it to pypi

xnuinside commented 1 year ago

@ahaessly I just released version 0.30.0, try it. Test was added - https://github.com/xnuinside/simple-ddl-parser/blob/main/tests/dialects/test_psql.py#L10, if will be needed anything more - open new issue. And thanks for reporting that!