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

Support "& symbol" #135

Closed kimjj81 closed 1 year ago

kimjj81 commented 2 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I have sql for initialize db and tables with tablespaces and functions. & symbol can be used in function - bit and operator and with "tablespace" keyword in Vertica - like "CREATE TABLE ... TABLESPACE &DATASPACE"

Describe the solution you'd like A clear and concise description of what you want to happen.

I think there are 2 options.

  1. Accept & symbol
  2. option parameter - ignore then continue to process

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

Thank you for your work.

xnuinside commented 2 years ago

Hi @kimjj81, thanks for reporting the issue! can you provide some more details: in what DB allowed & in sql ddl? Can you just send link to the documentation. It will be really helpful. And to DATASPACE - where is it used? In what db. Thank you!

kimjj81 commented 2 years ago

Hi @xnuinside I have a legacy sql file to initialize DB - Vertica ( https://vertica.com/ ) In that file & used as below

DEFINE TS=&1
CREATE TABLE (.....) TABLESPACE &TS;

CREATE OR REPLACE FUNCTION ... $BODY$
DECLARE
SOME_EVENT RECORD;
EX VARCHAR(3);
BEGIN
......
IF OPTIONS&64 <> 0 THEN ........

Unfortunately, I don't know much about vertica, and I didn't find documents of 'TABLESPACE'.

Thanks for you reply.

xnuinside commented 2 years ago

@kimjj81 got it, thank you, I will work on it

xnuinside commented 1 year ago

@kimjj81 this issue was fixed in version 0.28.0. I tested on sample:

DEFINE TS=&1
CREATE TABLE table( `id` INT NOT NULL) TABLESPACE &TS;

it produces normal output.

If will be needed anything else - feel free to open new issue.

And sorry that its takes so much time :)