Skip to content

Commit 742210e

Browse files
authored
Merge pull request #13 from hex-inc/dscott/nova-3074-dependency-not-recognized-when-with-time-zone-is-present
fix null dereference from `timestamp with time zone`
2 parents e1399c8 + 50015a0 commit 742210e

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

poetry.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sql_metadata/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,8 @@ def with_names(self) -> List[str]:
469469
while token.next_token and not token.is_with_query_end:
470470
token = token.next_token
471471
is_end_of_with_block = (
472-
token.next_token_not_comment.normalized
472+
token.next_token_not_comment is not None
473+
and token.next_token_not_comment.normalized
473474
in WITH_ENDING_KEYWORDS
474475
)
475476
if is_end_of_with_block:

test/test_duckdb.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,15 @@ def test_mega_join():
158158
for dataframe in dataframes:
159159
assert dataframe in parser.tables
160160
assert parser.query_type == "SELECT"
161+
162+
163+
def test_timestamp_with_time_zone():
164+
parser = Parser(
165+
"""
166+
SELECT *,
167+
CAST(ORDER_DATE as TIMESTAMP WITH TIME ZONE) as ingested_at
168+
FROM dataframe
169+
"""
170+
)
171+
assert "dataframe" in parser.tables
172+
assert parser.query_type == "SELECT"

0 commit comments

Comments
 (0)