shinichi-takii / ddlparse

DDL parase and Convert to BigQuery JSON schema and DDL statements
https://pypi.org/project/ddlparse/
BSD 3-Clause "New" or "Revised" License
87 stars 29 forks source link

Add supports column comments in BigQuery DDL #37

Closed shinichi-takii closed 5 years ago

shinichi-takii commented 5 years ago

Requirements

Example

DDL example:

CREATE TABLE Sample_Table (
  Col_01 character varying(100) PRIMARY KEY COMMENT 'Single Quote',
  Col_02 text NOT NULL COMMENT "Double Quote",
  Col_03 integer COMMENT 'in "Quote"',
  Col_04 integer COMMENT "in 'Quote'",
  Col_05 integer COMMENT 'コメント is full-width(Japanese) character',
  Col_06 float -- COMMENT 'Comment out'
);

BigQuery DDL output:

#standardSQL
CREATE TABLE `project.dataset.Sample_Table`
(
  Col_01 STRING NOT NULL OPTIONS (description = "Single Quote"),
  Col_02 STRING NOT NULL OPTIONS (description = "Double Quote"),
  Col_03 INT64 OPTIONS (description = "in \"Quote\""),
  Col_04 INT64 OPTIONS (description = "in 'Quote'"),
  Col_05 INT64 OPTIONS (description = "コメント is full-width(Japanese) character"),
  Col_06 FLOAT64
)