Skip to content

Commit

Permalink
Fix Snowflake database ISO week truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeengland committed Apr 9, 2021
1 parent 848000d commit 63c1272
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fireant/database/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class SnowflakeDatabase(Database):
# The pypika query class to use for constructing queries
query_cls = SnowflakeQuery

DATETIME_INTERVALS = {'hour': 'HH', 'day': 'DD', 'week': 'IW', 'month': 'MM', 'quarter': 'Q', 'year': 'Y'}
DATETIME_INTERVALS = {'hour': 'HH', 'day': 'DD', 'week': 'W', 'month': 'MM', 'quarter': 'Q', 'year': 'Y'}
_private_key = None

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion fireant/tests/database/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_trunc_day(self):
def test_trunc_week(self):
result = SnowflakeDatabase().trunc_date(Field('date'), 'week')

self.assertEqual('TRUNC("date",\'IW\')', str(result))
self.assertEqual('TRUNC("date",\'W\')', str(result))

def test_trunc_quarter(self):
result = SnowflakeDatabase().trunc_date(Field('date'), 'quarter')
Expand Down

0 comments on commit 63c1272

Please sign in to comment.