Skip to content

Commit

Permalink
chore: bump sqlglot 23.12.2
Browse files Browse the repository at this point in the history
fixes #83
  • Loading branch information
tekumara committed May 1, 2024
1 parent dbffa01 commit d22facb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fakesnow/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def extract_comment_on_table(expression: exp.Expression) -> exp.Expression:
if props := cast(exp.Properties, expression.args.get("properties")):
other_props = []
for p in props.expressions:
if isinstance(p, exp.SchemaCommentProperty) and (isinstance(p.this, (exp.Literal, exp.Identifier))):
if isinstance(p, exp.SchemaCommentProperty) and (isinstance(p.this, (exp.Literal, exp.Var))):
comment = p.this.this
else:
other_props.append(p)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies = [
"duckdb~=0.10.0",
"pyarrow",
"snowflake-connector-python",
"sqlglot~=23.3.0",
"sqlglot~=23.12.2",
]

[project.urls]
Expand Down
7 changes: 7 additions & 0 deletions tests/test_fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,13 @@ def test_show_primary_keys(dcur: snowflake.connector.cursor.SnowflakeCursor):
assert result3 == []


def test_sqlglot_regression(cur: snowflake.connector.cursor.SnowflakeCursor):
assert cur.execute(
"""with SOURCE_TABLE AS (SELECT '2024-01-01' AS start_date)
SELECT date(a.start_date) from SOURCE_TABLE AS a"""
).fetchone() == (datetime.date(2024, 1, 1),)


def test_sqlstate(cur: snowflake.connector.cursor.SnowflakeCursor):
cur.execute("select 'hello world'")
# sqlstate is None on success
Expand Down

0 comments on commit d22facb

Please sign in to comment.