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

Downloads
1.5M
Stars
166
Committers
6

Bot releases are visible (Hide)

simple-ddl-parser - v0.26.3 - Few Improvements

Published by xnuinside over 2 years ago

Improvements:

  1. Added support for OR REPLACE in CREATE TABLE: https://github.com/xnuinside/simple-ddl-parser/issues/131
  2. Added support for AUTO INCREMENT in column: https://github.com/xnuinside/simple-ddl-parser/issues/130
simple-ddl-parser - v0.26.2 - SNOWFLAKE dialect fixes

Published by xnuinside over 2 years ago

v0.26.2

Fixes:

  1. Fixed a huge bug for incorrect parsing lines with 'USE' & 'GO' strings inside.
  2. Fixed parsing for CREATE SCHEMA for Snowlake & Oracle DDLs

Improvements:

  1. Added COMMENT statement for CREATE TABLE ddl (for SNOWFLAKE dialect support)
  2. Added COMMENT statement for CREATE SCHEMA ddl (for SNOWFLAKE dialect support)
simple-ddl-parser - 0.26.1 - HQL fixes

Published by xnuinside over 2 years ago

Fixes:

  1. support Multiple SERDEPROPERTIES - https://github.com/xnuinside/simple-ddl-parser/issues/126
  2. Fix for issue with LOCATION and TBLPROPERTIES clauses in CREATE TABLE LIKE - https://github.com/xnuinside/simple-ddl-parser/issues/125
  3. LOCATION now works correctly with double quote strings
simple-ddl-parser - v0.26.0 - Fixes & Improvements release

Published by xnuinside over 2 years ago

Improvements:

  1. Added more explicit debug message on Statement errors - https://github.com/xnuinside/simple-ddl-parser/issues/116
  2. Added support for "USING INDEX TABLESPACE" statement in ALTER - https://github.com/xnuinside/simple-ddl-parser/issues/119
  3. Added support for IN statements in CHECKS - https://github.com/xnuinside/simple-ddl-parser/issues/121

New features:

  1. Support SparkSQL USING - https://github.com/xnuinside/simple-ddl-parser/issues/117
    Updates initiated by ticket https://github.com/xnuinside/simple-ddl-parser/issues/120:
  2. In Parser you can use argument json_dump=True in method .run() if you want get result in JSON format.
  • README updated

Fixes:

  1. Added support for PARTITION BY one column without type
  2. Alter table add constraint PRIMARY KEY - https://github.com/xnuinside/simple-ddl-parser/issues/119
  3. Fix for paring SET statement - https://github.com/xnuinside/simple-ddl-parser/pull/122
  4. Fix for disappeared colums without properties - https://github.com/xnuinside/simple-ddl-parser/issues/123
simple-ddl-parser - v0.25.0 New flags in Parser: normalize_names=True and silent=False

Published by xnuinside over 2 years ago

v0.25.0

Fixes:

  1. Fix for issue with 'at time zone' https://github.com/xnuinside/simple-ddl-parser/issues/112

New features:

  1. Added flag to raise errors if parser cannot parse statement DDLParser(.., silent=False) - https://github.com/xnuinside/simple-ddl-parser/issues/109
  2. Added flag to DDLParser(.., normalize_names=True) that change output of parser:
    if flag is True (default 'False') then all identifiers will be returned without '[', '"' and other delimeters that used in different SQL dialects to separate custom names from reserverd words & statements.
    For example, if flag set 'True' and you pass this input:

CREATE TABLE [dbo].[TO_Requests](
[Request_ID] [int] IDENTITY(1,1) NOT NULL,
[user_id] [int]

In output you will have names like 'dbo' and 'TO_Requests', not '[dbo]' and '[TO_Requests]'.

simple-ddl-parser - 0.24.1 if_not_exists added to output

Published by xnuinside almost 3 years ago

Fixes:

HQL:

  1. fields_terminated_by now parses , as "','", not as '' previously

Common:

  1. To output added 'if_not_exists' field in result to get availability 1-to-1 re-create ddl by metadata.
simple-ddl-parser - 0.24.0 HQL support for CLUSTERED BY, INTO .. BUCKETS and more

Published by xnuinside almost 3 years ago

Fixes:

HQL:

  1. More then 2 tblproperties now are parsed correctly https://github.com/xnuinside/simple-ddl-parser/pull/104

Common:

  1. 'set' in lower case now also parsed validly.
  2. Now names like 'schema', 'database', 'table' can be used as names in CREATE DABASE | SCHEMA | TABLESPACE | DOMAIN | TYPE statements and after INDEX and CONSTRAINT.
  3. Creation of empty tables also parsed correctly (like CREATE Table table;).

New Statements Support:

HQL:

  1. Added support for CLUSTERED BY - https://github.com/xnuinside/simple-ddl-parser/issues/103
  2. Added support for INTO ... BUCKETS
  3. CREATE REMOTE DATABASE | SCHEMA
simple-ddl-parser - 0.23.0 - ALTER TABLE ONLY, ALTER TABLE IF EXISTS + refactoring

Published by xnuinside almost 3 years ago

v0.23.0

Big refactoring: less code complexity & increase code coverage. Radon added to pre-commit hooks.

Fixes:

  1. Fix for issue with ALTER UNIQUE - https://github.com/xnuinside/simple-ddl-parser/issues/101

New Features

  1. SQL Comments string from DDL now parsed to "comments" key in output.

PostgreSQL:

  1. Added support for ALTER TABLE ONLY | ALTER TABLE IF EXISTS
simple-ddl-parser - 0.22.6 Improvements for PostgreSQL

Published by xnuinside almost 3 years ago

v0.22.6

Fixes:

  1. Fix for: https://github.com/xnuinside/simple-ddl-parser/issues/99
    Issue with pg_dump output:
    Now SETs with = and ; in them are parsed normally.

Improvements:

  1. Added support for types with 3+ words like PostgreSQL "timestamp without time zone"
  2. Added support for SEQUENCE properties with 'NO' word like NO MAXVALUE.
    It's parsed now as 'maxvalue': False}
simple-ddl-parser - 0.22.4 - BigQuery dialect support improvements

Published by xnuinside almost 3 years ago

v0.22.4

Fixes:

BigQuery:

  1. Fixed issue with parsing schemas with project in name.
  2. Added support for multiple OPTION() statements
simple-ddl-parser - BigQuery OPTIONS in table & column definition

Published by xnuinside almost 3 years ago

v0.22.1

New Features:

BigQuery:

  1. Added support for OPTION for full CREATE TABLE statement & column definition

Improvements:

  1. CLUSTED BY can be used without ()
simple-ddl-parser - v0.22.0 - fixes & refactoring before adding the support for BigQuery dialect

Published by xnuinside almost 3 years ago

v0.22.0

New Features:

BigQuery:

I started to add partial support for BigQuery

  1. Added support for OPTIONS in CREATE SCHEMA statement

MSSQL:

  1. Added support for PRIMARY KEY CLUSTERED - full details about clusterisation are parsed now in separate key 'clustered_primary_key'.
    I don't like that but when I started I did not thought about all those details, so in version 1.0.* I will work on more beutiful and logically output structure.
    https://github.com/xnuinside/simple-ddl-parser/issues/91

Pay attention: previously they parsed somehow, but in incorrect structure.

Improvements:

  1. Strings in double quotes moved as separate token from ID to fix a lot of issues with strings with spaces inside
  2. Now parser can parse statements separated by new line also (without GO or ; at the end of statement) - https://github.com/xnuinside/simple-ddl-parser/issues/90

Fixes:

  1. Now open strings is not valid in checks (previously the was parsed.) Open string sample 'some string (exist open quote, but there is no close quote)
  2. Order like ASC, DESK in primary keys now parsed valid (not as previously as column name)
simple-ddl-parser - v0.21.0 Big MSSQL support updates

Published by xnuinside about 3 years ago

v0.21.0

New Features:

MSSQL:

  1. Added support for statements:
    1. PERIOD FOR SYSTEM_TIME in CREATE TABLE statement
    2. ON [PRIMARY] after CREATE TABLE statement (sample in test files test_mssql_specific.py)
    3. WITH statement for TABLE properties
    4. TEXTIMAGE_ON statement
    5. DEFAULT NEXT VALUE FOR in COLUMN DEFAULT

Common:

  1. Added support for separating tables DDL by 'GO' statement as in output of MSSQL
  2. Added support for CREATE TYPE as TABLE
simple-ddl-parser - v0.20.0 SET statement support & some MSSQL & MySQL statements

Published by xnuinside about 3 years ago

v0.20.0

New Features:

Common

  1. SET statements from DDL scripts now collected as type 'ddl_properties' (if you use group_by_type=True) and parsed as
    dicts with 2 keys inside {'name': 'property name', 'value': 'property value'}

MySQL

  1. Added support for MySQL ON UPDATE statements in column (without REFERENCE)

MSSQL

  1. Added support for CONSTRAINT [CLUSTERED]... PRIMARY KEY for Table definition
  2. Added support for WITH statement in CONSTRAINT (Table definition)
simple-ddl-parser - v0.19.7 - Added support for HQL STORED AS INPUTFORMAT, OUTPUTFORMAT, SKEWED BY

Published by xnuinside about 3 years ago

v0.19.7

Fixes:

  1. Add support for more special symbols to strings - https://github.com/xnuinside/simple-ddl-parser/issues/68

Features:

  1. Added support for HQL statements:
    STORED AS INPUTFORMAT, OUTPUTFORMAT - https://github.com/xnuinside/simple-ddl-parser/issues/69
    SKEWED BY
simple-ddl-parser - v0.19.6 - HQL TBLPROPERTIES support & bug fixing

Published by xnuinside about 3 years ago

v0.19.6

Fixes:

  1. Fixed issue with PARTITIONED BY multiple columns in HQL - https://github.com/xnuinside/simple-ddl-parser/issues/66
  2. Question symbol '?' now handled valid in strings - https://github.com/xnuinside/simple-ddl-parser/issues/64
  3. Fixed issue with escaping symbols & added tests -https://github.com/xnuinside/simple-ddl-parser/issues/63

Features:

  1. Added support for HQL statement TBLPROPERTIES - https://github.com/xnuinside/simple-ddl-parser/issues/65
simple-ddl-parser - v0.19.5 - COMMENTs finally works in

Published by xnuinside about 3 years ago

v0.19.5
Fixes:

1. Fixed issues with COMMENT statement in column definitions. Added bunch of tests, now they expect working ok.

DDL like:

CREATE EXTERNAL TABLE test (
job_id STRING COMMENT 't# est | & * % $ // * 6 % !'
)
STORED AS PARQUET LOCATION 'hdfs://test'

Now parsed valid.

simple-ddl-parser - v0.19.0 Base Snowflake support and other

Published by xnuinside about 3 years ago

v0.19.0

Features

  1. Added support for base Snowflake SQL Dialect.
    Added new --output-mode='snowflake' (add "clone" key)

Added support for CREATE .. CLONE with same behaviour as CREATE .. LIKE
Added support for CREATE .. CLONE for schemas and database - displayed in output as {"clone": {"from": ... }}
CREATE TABLE .. CLUSTER BY ..
CONSTRAINT .. [NOT] ENFORCED (value stored in 'primary_key_enforced')

  1. in CREATE DATABASE properties that goes after name like key=value now parsed valid. Check examples in tests
  2. Added support for varchar COLLATE column property
simple-ddl-parser - v0.18.0: AWS Redshift DDL dialect support

Published by xnuinside about 3 years ago

Features

  1. Added base support fot AWS Redshift SQL dialect.
    Added support for ENCODE property in column.
    Added new --output-mode='redshift' that add to column 'encrypt' property by default.
    Also add table properties: distkeys, sortkey, diststyle, encode (table level encode), temp.

Supported Redshift statements: SORTKEY, DISTSTYLE, DISTKEY, ENCODE

CREATE TEMP / TEMPORARY TABLE

syntax like with LIKE statement:

create temp table tempevent(like event);

simple-ddl-parser - CREATE TABLESPACE, CREATE DATABASE statements support

Published by xnuinside over 3 years ago

  1. All dependencies were updated for the latest version.
  2. Added base support for CREATE [BIGFILE | SMALLFILE] [TEMPORARY] TABLESPACE
  3. Added support for create table properties like TABLESPACE user_data ENABLE STORAGE IN ROW CHUNK 8K RETENTION CACHE
  4. Added support for CREATE DATABASE statement