We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello there! Thanks for a great lib, seems to work well.
One issue I've found, is if a schema has a dot in the schema (albeit annoyingly, but no control over naming), parsing will fail.
Minimal example:
from ddlparse import DdlParse ddl = """ create table "foo.bar"."bazz" ( id int ); """ DdlParse(ddl).parse() # pyparsing.ParseException DdlParse(ddl.replace('foo.bar', 'foo_bar')).parse() # okay.
Exception:
pyparsing.ParseException: Expected {Suppress:({"--" Re:('.+')}) | {Suppress:("CREATE") ["TEMP"] Suppress:("TABLE") [Suppress:("IF NOT EXISTS")] [{Suppress:("") | Suppress:(""")}] [{W:(ABCD...) [{Suppress:("") | Suppress:(""")}] Suppress:(".") [{Suppress:("") | Suppress:(""")}]}] W:(ABCD...) [{Suppress:("") | Suppress:(""")}] Suppress:("(") {{{{{Suppress:({"--" Re:('.+')}) | Suppress:({"KEY" W:(ABCD...)})} | Group:({[{{{Suppress:("CONSTRAINT") [{Suppress:("") | Suppress:(""")}]} W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}] {{{{{{{{{{"PRIMARY KEY" ^ "UNIQUE"} ^ "UNIQUE KEY"} ^ "NOT NULL"} [{Suppress:("") | Suppress:(""")}]} [W:(ABCD...)]} [{Suppress:("") | Suppress:(""")}]} Suppress:("(")} Group:({{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} [, {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}]...)} Suppress:(")")} | {{{{"FOREIGN KEY" Suppress:("(")} Group:({{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} [, {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}]...)} Suppress:(")")} [{{{{{{{{{Suppress:("REFERENCES") [{Suppress:("") | Suppress:(""")}]} W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} Suppress:("(")} Group:({{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} [, {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}]...)} Suppress:(")")} [{"MATCH" W:(ABCD...)}]} [{{"ON" "DELETE"} {{{"RESTRICT" | "CASCADE"} | "SET NULL"} | "NO ACTION"}}]} [{{"ON" "UPDATE"} {{{"RESTRICT" | "CASCADE"} | "SET NULL"} | "NO ACTION"}}]}]}}})} | Group:({{{{{{{Suppress:("") | Suppress:(""")} W:(ABCD...)} {Suppress:("") | Suppress:(""")}} ^ {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}} Group:({{{Group:({W:(ABCD...) [{{{"WITHOUT TIME ZONE" ^ "WITH TIME ZONE"} ^ "PRECISION"} ^ "VARYING"}]}) [{{{Suppress:("(") Re:('[\d\]+\s,\s\d*')} [{"CHAR" | "BYTE"}]} Suppress:(")")}]} ["UNSIGNED"]} ["ZEROFILL"]})} [W:([])]} [{Re:('(?!--)') Group:({{{{{{{{[Re:('\b(?:NOT\s+)?NULL?\b')] & [Re:('\bAUTO_INCREMENT\b')]} & [Re:('\b(UNIQUE|PRIMARY)(?:\s+KEY)?\b')]} & [Re:('\bDEFAULT\b\s+(?:((?:[A-Za-z0-9_\.\'\" -\{\}]|[^\\x01-\\x7E])\:\:(?:character varying)?[A-Za-z0-9\[\]]+)|(?:\')((?:\\\'|[^\\\']|,)+)(?:\')|(?:\")((?:\\\"|[^\\"]|,)+)(?:\")|([^,\\s]+))')]} & [Re:('\bCOMMENT\b\s+(\'(\\\'|[^\\\']|,)+\'|\"(\\\"|[^\\"]|,)+\"|[^,\\s]+)')]} & [Re:('\bENCODE\s+[A-Za-z0-9]+\b')]} & ["DISTKEY"]} & ["SORTKEY"]} & [{Suppress:("CHARACTER SET") W:(ABCD...)}]})}]})} | Suppress:({"--" Re:('.+')})}}... [, {{{{{Suppress:({"--" Re:('.+')}) | Suppress:({"KEY" W:(ABCD...)})} | Group:({[{{{Suppress:("CONSTRAINT") [{Suppress:("") | Suppress:(""")}]} W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}] {{{{{{{{{{"PRIMARY KEY" ^ "UNIQUE"} ^ "UNIQUE KEY"} ^ "NOT NULL"} [{Suppress:("") | Suppress:(""")}]} [W:(ABCD...)]} [{Suppress:("") | Suppress:(""")}]} Suppress:("(")} Group:({{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} [, {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}]...)} Suppress:(")")} | {{{{"FOREIGN KEY" Suppress:("(")} Group:({{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} [, {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}]...)} Suppress:(")")} [{{{{{{{{{Suppress:("REFERENCES") [{Suppress:("") | Suppress:(""")}]} W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} Suppress:("(")} Group:({{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]} [, {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}]...)} Suppress:(")")} [{"MATCH" W:(ABCD...)}]} [{{"ON" "DELETE"} {{{"RESTRICT" | "CASCADE"} | "SET NULL"} | "NO ACTION"}}]} [{{"ON" "UPDATE"} {{{"RESTRICT" | "CASCADE"} | "SET NULL"} | "NO ACTION"}}]}]}}})} | Group:({{{{{{{Suppress:("") | Suppress:(""")} W:(ABCD...)} {Suppress:("") | Suppress:(""")}} ^ {{[{Suppress:("") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("") | Suppress:(""")}]}} Group:({{{Group:({W:(ABCD...) [{{{"WITHOUT TIME ZONE" ^ "WITH TIME ZONE"} ^ "PRECISION"} ^ "VARYING"}]}) [{{{Suppress:("(") Re:('[\d\]+\s*,\s\d*')} [{"CHAR" | "BYTE"}]} Suppress:(")")}]} ["UNSIGNED"]} ["ZEROFILL"]})} [W:([])]} [{Re:('(?!--)') Group:({{{{{{{{[Re:('\b(?:NOT\s+)?NULL?\b')] & [Re:('\bAUTO_INCREMENT\b')]} & [Re:('\b(UNIQUE|PRIMARY)(?:\s+KEY)?\b')]} & [Re:('\bDEFAULT\b\s+(?:((?:[A-Za-z0-9_\.\'\" -\{\}]|[^\\x01-\\x7E])*\:\:(?:character varying)?[A-Za-z0-9\[\]]+)|(?:\')((?:\\\'|[^\\\']|,)+)(?:\')|(?:\")((?:\\\"|[^\\"]|,)+)(?:\")|([^,\\s]+))')]} & [Re:('\bCOMMENT\b\s+(\'(\\\'|[^\\\']|,)+\'|\"(\\\"|[^\\"]|,)+\"|[^,\\s]+)')]} & [Re:('\bENCODE\s+[A-Za-z0-9]+\b')]} & ["DISTKEY"]} & ["SORTKEY"]} & [{Suppress:("CHARACTER SET") W:(ABCD...)}]})}]})} | Suppress:({"--" Re:('.+')})}}...]...}}, found '.' (at char 22), (line:1, col:23)
") | Suppress:(""")}] [{W:(ABCD...) [{Suppress:("
") | Suppress:(""")}]}] W:(ABCD...) [{Suppress:("
") | Suppress:(""")}]} W:(ABCD...)} [{Suppress:("
") | Suppress:(""")}]} [W:(ABCD...)]} [{Suppress:("
") | Suppress:(""")}] W:(ABCD...)} [{Suppress:("
") | Suppress:(""")} W:(ABCD...)} {Suppress:("
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Hello there!
Thanks for a great lib, seems to work well.
One issue I've found, is if a schema has a dot in the schema (albeit annoyingly, but no control over naming), parsing will fail.
Minimal example:
Exception:
The text was updated successfully, but these errors were encountered: