Skip to content

Commit

Permalink
Merge pull request #39 from shinichi-takii/feature/add-supports-comme…
Browse files Browse the repository at this point in the history
…nt-statements

Add supports the parse of COMMENT statements
  • Loading branch information
shinichi-takii authored Jun 14, 2019
2 parents 7328656 + 8c9a092 commit 3f42a66
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 292 deletions.
42 changes: 31 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Changelog

## 1.2.3
## [1.3.0] - 2019-06-15
### Added
- Add supports the parse of `COMMENT` statements.
- Add `DdlParseColumn.comment` property.
- Add `DdlParseColumn.description` property for the `DdlParseColumn.comment` property alias.
- Add supports column comments in BigQuery DDL.

## [1.2.3] - 2019-02-17
- Fix parse error for MySQL DDL with 'FOREIGN KEY'.
- Fix not completely parsed with block comments.

## 1.2.2
## [1.2.2] - 2019-02-02
- Fix FutureWarning of Python 3.7.
- Add supports PostgreSQL data type.
- `UUID`
- Fix parse `DEFAULT` value.
- Add parse regex of `DEFAULT` value.

## 1.2.1
## [1.2.1] - 2019-01-27
- Add supports for Python 3.7.
- Pass Python 3.7 test.
- Add supports PostgreSQL data type.
Expand All @@ -21,7 +28,7 @@
- Fix parse `DEFAULT` value.
- Add decimal point to `DEFAULT` parse character.

## 1.2.0
## [1.2.0] - 2019-01-02
- Add `DdlParseTable.to_bigquery_ddl` function.
- BigQuery DDL (CREATE TABLE) statement generate function.
- Add `DdlParseColumn.bigquery_legacy_data_type` property.
Expand All @@ -30,35 +37,48 @@
- Add `DdlParseColumn.bigquery_standard_data_type` property.
- Get BigQuery Standard SQL data property.

## 1.1.3
## [1.1.3] - 2018-08-02
- Add support inline comment.
- Add support constraint name with quotes.
- Add support Oracle Length Semantics for Character Datatypes.

## 1.1.2
## [1.1.2] - 2018-03-25
- Add support Oracle data type.
- `CLOB`, `NCLOB`
- `NUMBER` with no length & scale specification
- Miner fix.

## 1.1.1
## [1.1.1] - 2018-03-25
- Fix Postgres/Redshift parse of "::" syntax in field attribute.

## 1.1.0
## [1.1.0] - 2018-01-14
- Add `source_database` option.
- Add `to_bigquery_fields` method to Columns dicttionary(`DdlParseColumnDict` class).
- Fix BigQuery convert of Oracle data type.
- Oracle 'DATE' -> BigQuery 'DATETIME'
- Oracle 'NUMBER' -> BigQuery 'INTEGER' or 'FLOAT'

## 1.0.2
## [1.0.2] - 2018-01-09
- Miner enhancement.
- `ddlparse.py` : Exclude unused module.
- `example.py` : Modified comment.
- `README.md` : Miner fix.

## 1.0.1
## [1.0.1] - 2018-01-07
- Miner enhancement.

## 1.0.0
## [1.0.0]
- Initial released.

[1.3.0]: https://github.com/shinichi-takii/ddlparse/compare/v1.2.3...v1.3.0
[1.2.3]: https://github.com/shinichi-takii/ddlparse/compare/v1.2.2...v1.2.3
[1.2.2]: https://github.com/shinichi-takii/ddlparse/compare/v1.2.1...v1.2.2
[1.2.1]: https://github.com/shinichi-takii/ddlparse/compare/v1.2.0...v1.2.1
[1.2.0]: https://github.com/shinichi-takii/ddlparse/compare/v1.1.3...v1.2.0
[1.1.3]: https://github.com/shinichi-takii/ddlparse/compare/v1.1.2...v1.1.3
[1.1.2]: https://github.com/shinichi-takii/ddlparse/compare/v1.1.1...v1.1.2
[1.1.1]: https://github.com/shinichi-takii/ddlparse/compare/v1.1.0...v1.1.1
[1.1.0]: https://github.com/shinichi-takii/ddlparse/compare/1.0.2...v1.1.0
[1.0.2]: https://github.com/shinichi-takii/ddlparse/compare/1.0.1...1.0.2
[1.0.1]: https://github.com/shinichi-takii/ddlparse/compare/1.0.0...1.0.1
[1.0.0]: https://github.com/shinichi-takii/ddlparse/releases/tag/1.0.0
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
include LICENSE
include *.md
exclude README.md
include requirements.txt
include test-requirements.txt
include setup.cfg
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ from ddlparse.ddlparse import DdlParse

sample_ddl = """
CREATE TABLE My_Schema.Sample_Table (
Id integer PRIMARY KEY,
Name varchar(100) NOT NULL,
Id integer PRIMARY KEY COMMENT 'User ID',
Name varchar(100) NOT NULL COMMENT 'User name',
Total bigint NOT NULL,
Avg decimal(5,1) NOT NULL,
Created_At date, -- Oracle 'DATE' -> BigQuery 'DATETIME'
Expand Down Expand Up @@ -123,6 +123,8 @@ for col in table.columns.values():
col_info.append("unique = {}".format(col.unique))
col_info.append("bq_legacy_data_type = {}".format(col.bigquery_legacy_data_type))
col_info.append("bq_standard_data_type = {}".format(col.bigquery_standard_data_type))
col_info.append("comment = '{}'".format(col.comment))
col_info.append("description(=comment) = '{}'".format(col.description))
col_info.append("BQ {}".format(col.to_bigquery_field()))
print(" : ".join(col_info))

Expand Down
195 changes: 0 additions & 195 deletions README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion ddlparse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from .ddlparse import *

__copyright__ = 'Copyright (C) 2018-2019 Shinichi Takii'
__version__ = '1.2.3'
__version__ = '1.3.0'
__license__ = 'BSD-3-Clause'
__author__ = 'Shinichi Takii'
__author_email__ = 'shinichi.takii@gmail.com'
Expand Down
Loading

0 comments on commit 3f42a66

Please sign in to comment.