Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
);
""",
"bq_ddl": {
DdlParse.NAME_CASE.original:
"""\
#standardSQL
CREATE TABLE `project.dataset.Test_Table`
(
Col_01 STRING NOT NULL,
Col_02 STRING NOT NULL,
Col_03 ARRAY,
Col_04 ARRAY>>,
Col_05 ARRAY>>>>,
Col_06 ARRAY
)""",
DdlParse.NAME_CASE.lower:
"""\
#standardSQL
CREATE TABLE `project.dataset.test_table`
(
col_01 STRING NOT NULL,
col_02 STRING NOT NULL,
col_03 ARRAY,
col_04 ARRAY>>,
col_05 ARRAY>>>>,
col_06 ARRAY
)""",
DdlParse.NAME_CASE.upper:
"""\
#standardSQL
CREATE TABLE `project.dataset.TEST_TABLE`
(
def test_bq_ddl(test_case):
# Get test data
data = TEST_DATA_DDL[test_case]
# Parse ddl
table = DdlParse().parse(data["source_ddl"])
# Check generate BigQuery DDL statements of DdlParseTable
assert table.to_bigquery_ddl() == textwrap.dedent(data["bq_ddl"][DdlParse.NAME_CASE.original])
assert table.to_bigquery_ddl(DdlParse.NAME_CASE.original) == textwrap.dedent(data["bq_ddl"][DdlParse.NAME_CASE.original])
assert table.to_bigquery_ddl(DdlParse.NAME_CASE.lower) == textwrap.dedent(data["bq_ddl"][DdlParse.NAME_CASE.lower])
assert table.to_bigquery_ddl(DdlParse.NAME_CASE.upper) == textwrap.dedent(data["bq_ddl"][DdlParse.NAME_CASE.upper])