You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Adding support Snowflake CREATE TABLE { AUTOINCREMENT | IDENTITY } column definition with explicit Order or NoOrder optional parameters
https://docs.snowflake.com/en/sql-reference/sql/create-table To Reproduce
run the following tests
`
def test_autoincrement_order():
# test for https://github.com/xnuinside/simple-ddl-parser/issues/20x
ddl = """CREATE TABLE table (surrogatekey_SK NUMBER(38,0) NOT NULL autoincrement start 1 increment 1 ORDER COMMENT 'Record Identification Number Ordered')"""
result = DDLParser(ddl).run(group_by_type=True)
expected = {
"ddl_properties": [],
"domains": [],
"schemas": [],
"sequences": [],
"tables": [
{
"alter": {},
"checks": [],
"columns": [
{
"check": None,
"comment": "Record Identification Number Ordered",
"default": None,
"name": "surrogatekey_SK",
"nullable": True,
"references": None,
"size": None,
"type": "int",
"unique": False,
"autoincrement":True,
"start" : 1,
"increment": 1
}
],
"index": [],
"partitioned_by": [],
"primary_key": [],
"schema": None,
"table_name": "table",
"tablespace": None,
}
],
"types": [],
}
assert result == expected
Describe the bug
Adding support Snowflake CREATE TABLE { AUTOINCREMENT | IDENTITY } column definition with explicit
Order
orNoOrder
optional parametershttps://docs.snowflake.com/en/sql-reference/sql/create-table
To Reproduce
run the following tests
`
def test_autoincrement_order():
# test for https://github.com/xnuinside/simple-ddl-parser/issues/20x
ddl = """CREATE TABLE table (surrogatekey_SK NUMBER(38,0) NOT NULL autoincrement start 1 increment 1 ORDER COMMENT 'Record Identification Number Ordered')"""
result = DDLParser(ddl).run(group_by_type=True)
expected = {
"ddl_properties": [],
"domains": [],
"schemas": [],
"sequences": [],
"tables": [
{
"alter": {},
"checks": [],
"columns": [
{
"check": None,
"comment": "Record Identification Number Ordered",
"default": None,
"name": "surrogatekey_SK",
"nullable": True,
"references": None,
"size": None,
"type": "int",
"unique": False,
"autoincrement":True,
"start" : 1,
"increment": 1
}
],
"index": [],
"partitioned_by": [],
"primary_key": [],
"schema": None,
"table_name": "table",
"tablespace": None,
}
],
"types": [],
}
assert result == expected
def test_autoincrement_noorder():
# test for https://github.com/xnuinside/simple-ddl-parser/issues/20x
ddl = """CREATE TABLE table (surrogatekey_SK NUMBER(38,0) NOT NULL autoincrement start 1 increment 1 NOORDER COMMENT 'Record Identification Number NoOrdered')"""
result = DDLParser(ddl).run(group_by_type=True)
expected = {
"ddl_properties": [],
"domains": [],
"schemas": [],
"sequences": [],
"tables": [
{
"alter": {},
"checks": [],
"columns": [
{
"check": None,
"comment": "Record Identification Number NoOrdered",
"default": None,
"name": "surrogatekey_SK",
"nullable": True,
"references": None,
"size": None,
"type": "int",
"unique": False,
"autoincrement":True,
"start" : 1,
"increment": None
}
],
"index": [],
"partitioned_by": [],
"primary_key": [],
"schema": None,
"table_name": "table",
"tablespace": None,
}
],
"types": [],
}
assert result == expected`
Expected behavior
no regression, keep autoincrement: true , increment:none in case of
NOORDER
and 1 in case ofORDER
The text was updated successfully, but these errors were encountered: