Skip to content

Commit

Permalink
Merge pull request #210 from xnuinside/208/pair_single_quotes
Browse files Browse the repository at this point in the history
added support for double single quotes in comment
  • Loading branch information
xnuinside authored Nov 5, 2023
2 parents fb0cd40 + 43f452b commit 482dc5a
Show file tree
Hide file tree
Showing 12 changed files with 38,224 additions and 500 deletions.
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ repos:
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell

30 changes: 15 additions & 15 deletions ARCHIVE_CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ CONSTRAINT .. [NOT] ENFORCED (value stored in 'primary_key_enforced')

**v0.18.0**
**Features**
1. Added base support fot AWS Redshift SQL dialect.
1. Added base support for 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.
Expand Down Expand Up @@ -102,7 +102,7 @@ Will be fixed in next releases.

**v0.16.0**
1. Fixed the issue when NULL column after DEFAULT used as default value.
2. Added support for generated columns, statatements: AS , GENERATED ALWAYS, STORED in Column Defenitions, in output it placed to key 'generated'. Keyword 'generated' showed only if column is generated.
2. Added support for generated columns, statatements: AS , GENERATED ALWAYS, STORED in Column definitions, in output it placed to key 'generated'. Keyword 'generated' showed only if column is generated.
3. Half of changelogs moved to ARCHIVE_CHANGELOG.txt
4. Added base support for CREATE DOMAIN statement
5. Added base support for CREATE SCHEMA [IF NOT EXISTS] ... [AUTHORIZATION] statement, added new type keyword 'schemas'
Expand All @@ -120,27 +120,27 @@ Will be fixed in next releases.
1. Added support for CONSTRAINT ... PRIMARY KEY ...
2. Added support for ENCRYPT [+ NO SALT, SALT, USING] statements for Oracle dialect. All default values taken from this doc https://docs.oracle.com/en/database/oracle/oracle-database/21/asoag/encrypting-columns-tables2.html
Now if you use output_mode='oracle' in column will be showed new property 'encrypt'.
If no ENCRYPT statement will be in table defenition - then value will be 'None', but if ENCRYPT exists when in encrypt property you will find this information:
If no ENCRYPT statement will be in table definition - then value will be 'None', but if ENCRYPT exists when in encrypt property you will find this information:

{'encrypt' : {
'salt': True,
'encryption_algorithm': 'AES192',
'integrity_algorithm': 'SHA-1'
}}

3. Added support for oracle STORAGE statement, 'oracle' output_mode now has key 'storage' in table data defenition.
4. Added support for TABLESPACE statement after columns defenition
3. Added support for oracle STORAGE statement, 'oracle' output_mode now has key 'storage' in table data definition.
4. Added support for TABLESPACE statement after columns definition

**v0.12.1**
1. () after DEFAULT now does not cause an issue
2. ' and " does not lost now in DEFAULT values

**v0.12.0**
1. Added support for MSSQL: types with 2 words like 'int IDENTITY',
FOREIGN KEY REFERENCES statement, supported 'max' as type size, CONSTRAINT ... UNIQUE statement in table defenition,
FOREIGN KEY REFERENCES statement, supported 'max' as type size, CONSTRAINT ... UNIQUE statement in table definition,
CONSTRAINT ... CHECK, CONSTRAINT ... FOREIGN KEY
2. Added output_mode types: 'mysql', 'mssql' for SQL Server, 'oracle'. If chosed one of the above -
added key 'constraints' in table defenition by default. 'constraints' contain dict with keys 'uniques', 'checks', 'references'
2. Added output_mode types: 'mysql', 'mssql' for SQL Server, 'oracle'. If chose one of the above -
added key 'constraints' in table definition by default. 'constraints' contain dict with keys 'uniques', 'checks', 'references'
it this is a COSTRAINT .. CHECK 'checks' key will be still in data output, but it will be duplicated to 'constraints': {'checks': ...}
3. Added support for ALTER ADD ... UNIQUE
4. Added support for CREATE CLUSTERED INDEX, if output_mode = 'mssql' then index will have additional arg 'clustered'.
Expand All @@ -157,8 +157,8 @@ it this is a COSTRAINT .. CHECK 'checks' key will be still in data output, but i
2. Added base support for statement CREATE TYPE: AS ENUM, AS OBJECT, INTERNALLENGTH, INPUT, OUTPUT (not all properties & types supported yet.)
3. Added argument 'group_by_type' in 'run' method that will group output by type of parsed entities like:
'tables': [all_pasrsed_tables], 'sequences': [all_pasrsed_sequences], 'types': [all_pasrsed_types], 'domains': [all_pasrsed_domains]
4. Type in column defenition also can be "schema"."YourCustomType"
5. " now are not dissapeared if you use them in DDL.
4. Type in column definition also can be "schema"."YourCustomType"
5. " now are not disappeared if you use them in DDL.

**v0.10.2**
1. Fix regex that find '--' in table names (to avoid issue with -- comment lines near string defaults)
Expand All @@ -180,8 +180,8 @@ STRUCT < street_address: STRUCT <street_number: INT, street_name: STRING, street
1. To DDLParser's run method was added 'output_mode' argument that expect valur 'hql' or 'sql' (by default).
Mode change result output. For example, in hql exists statement EXTERNAL. If you want to see in table information
is it EXTERNAL table or not - you need to set 'hql' output_mode.
2. Added suppport for hql EXTERNAL statement, STORED AS statement, LOCATION statement
3. Added suppport for PARTITIONED BY statement (for both hql & sql)
2. Added support for hql EXTERNAL statement, STORED AS statement, LOCATION statement
3. Added support for PARTITIONED BY statement (for both hql & sql)
4. Added support for HQL ROW FORMAT statement, FIELDS TERMINATED BY statement, COLLECTION ITEMS TERMINATED BY statement, MAP KEYS TERMINATED BY statement

**v0.7.4**
Expand Down Expand Up @@ -214,11 +214,11 @@ is it EXTERNAL table or not - you need to set 'hql' output_mode.
4. Added support for FOREIGN Constratint in ALTER TABLE

**v0.4.0**
1. Added support schema for table in REFERENCES statement in column defenition
2. Added base support fot Alter table statements (added 'alters' key in table)
1. Added support schema for table in REFERENCES statement in column definition
2. Added base support for Alter table statements (added 'alters' key in table)
3. Added command line arg to pass path to get the output results
4. Fixed incorrect null fields parsing

**v0.3.0**
1. Added support for REFERENCES statement in column defenition
1. Added support for REFERENCES statement in column definition
2. Added command line
20 changes: 11 additions & 9 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
**v0.31.1**
### Improvements
#### Snowflake update:
1. Support multiple tag definitions in a single `WITH TAG` statement.
2. Added support for Snowflake double single quotes - https://github.com/xnuinside/simple-ddl-parser/issues/208

**v0.31.0**
### Fixes:
Expand Down Expand Up @@ -34,7 +36,7 @@ Added support for ORGANIZE BY statement
### Fixes
1. Fix for https://github.com/xnuinside/simple-ddl-parser/issues/177

### Imporvements
### Improvements
1. Added support for Oracle 2 component size for types, like '30 CHAR'. From https://github.com/xnuinside/simple-ddl-parser/issues/176


Expand All @@ -52,8 +54,8 @@ It shows in column attribute 'type_parameters'.


**v0.28.1**
Imporvements:
1. Lines started with INSERT INTO statement now successfully ignored by parser (so you can keep them in ddl - they will be just skiped)
Improvements:
1. Lines started with INSERT INTO statement now successfully ignored by parser (so you can keep them in ddl - they will be just skipped)

Fixes:
1. Important fix for multiline comments
Expand All @@ -73,7 +75,7 @@ Thanks for the sample in the issue: https://github.com/xnuinside/simple-ddl-pars
Improvements:
MariaDB:
1. Added support for MariaDB AUTO_INCREMENT (from ddl here - https://github.com/xnuinside/simple-ddl-parser/issues/144)
If column is Auto Incremented - it indicated as 'autoincrement': True in column defenition
If column is Auto Incremented - it indicated as 'autoincrement': True in column definition

Common:
1. Added parsing for multiline comments in DDL with `/* */` syntax.
Expand All @@ -86,7 +88,7 @@ parse_from_file('path_to_file', parser_settings={'log_level': logging.WARNING}).

Fixes:
1. Fixed parsing CHECKS with IN statement - https://github.com/xnuinside/simple-ddl-parser/issues/150
2. @# symbols added to ID token - (partialy) https://github.com/xnuinside/simple-ddl-parser/issues/146
2. @# symbols added to ID token - (partially) https://github.com/xnuinside/simple-ddl-parser/issues/146


Improvements:
Expand Down Expand Up @@ -154,7 +156,7 @@ 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
4. Fix for disappeared columns without properties - https://github.com/xnuinside/simple-ddl-parser/issues/123

**v0.25.0**
## Fixes:
Expand All @@ -165,7 +167,7 @@ Fixes:

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.
if flag is True (default 'False') then all identifiers will be returned without '[', '"' and other delimiters that used in different SQL dialects to separate custom names from reserved words & statements.
For example, if flag set 'True' and you pass this input:

CREATE TABLE [dbo].[TO_Requests](
Expand Down Expand Up @@ -201,7 +203,7 @@ In output you will have names like 'dbo' and 'TO_Requests', not '[dbo]' and '[TO
### Common:

2. 'set' in lower case now also parsed validly.
3. 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. Now names like 'schema', 'database', 'table' can be used as names in CREATE DATABASE | SCHEMA | TABLESPACE | DOMAIN | TYPE statements and after INDEX and CONSTRAINT.
4. Creation of empty tables also parsed correctly (like CREATE Table table;).

## New Statements Support:
Expand Down Expand Up @@ -276,7 +278,7 @@ I started to add partial support for BigQuery
## 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.
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 beautiful and logically output structure.
https://github.com/xnuinside/simple-ddl-parser/issues/91

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

0 comments on commit 482dc5a

Please sign in to comment.