-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
consolidate timestamp macros #273
Conversation
Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-snowflake contributing guide. |
removed, will look into dev reqs later
…abs/dbt-snowflake into consolidateTimestampMacros
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good 👍
Left one comment for you to take a peek at related to casing and another related to pytest class conventions.
✅ Manually confirmed the same results that you got in your automated tests:
Output
snowflake dbt_utils.current_timestamp():
current_timestamp::TIMESTAMP
snowflake dbt.current_timestamp_backcompat():
current_timestamp::TIMESTAMP
snowflake dbt_utils.current_timestamp_in_utc():
convert_timezone('UTC',
current_timestamp::TIMESTAMP
)::TIMESTAMP
snowflake dbt.current_timestamp_in_utc_backcompat():
convert_timezone('UTC',
current_timestamp::TIMESTAMP
)::TIMESTAMP
Merge notes
After dbt-labs/dbt-core#5838 is merged, then you can commit an update to dev-requirements.txt
in this PR prior to merging it.
{{current_timestamp_backcompat()}} as current_timestamp_backcompat | ||
""" | ||
|
||
class TestCurrentTimestampSnowflake(test_timestamps.TestCurrentTimestamps): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
from dbt.tests.adapter.utils import test_timestamps | ||
|
||
_MODEL_CURRENT_TIMESTAMP = """ | ||
SELECT {{current_timestamp()}} as current_timestamp, | ||
{{current_timestamp_in_utc_backcompat()}} as current_timestamp_in_utc_backcompat, | ||
{{current_timestamp_backcompat()}} as current_timestamp_backcompat | ||
""" | ||
|
||
|
||
class TestCurrentTimestampSnowflake(test_timestamps.BaseCurrentTimestamps): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per @gshank's comment here, let's make this consistent with the rest of the code base.
from dbt.tests.adapter.utils import test_timestamps | |
_MODEL_CURRENT_TIMESTAMP = """ | |
SELECT {{current_timestamp()}} as current_timestamp, | |
{{current_timestamp_in_utc_backcompat()}} as current_timestamp_in_utc_backcompat, | |
{{current_timestamp_backcompat()}} as current_timestamp_backcompat | |
""" | |
class TestCurrentTimestampSnowflake(test_timestamps.BaseCurrentTimestamps): | |
from dbt.tests.adapter.utils.test_timestamps import BaseCurrentTimestamps | |
_MODEL_CURRENT_TIMESTAMP = """ | |
SELECT {{current_timestamp()}} as current_timestamp, | |
{{current_timestamp_in_utc_backcompat()}} as current_timestamp_in_utc_backcompat, | |
{{current_timestamp_backcompat()}} as current_timestamp_backcompat | |
""" | |
class TestCurrentTimestampSnowflake(BaseCurrentTimestamps): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* consolidate timestamp macros * add testing changes * deleting extra timestamps.sql * changie entry * fix backcompat * Update Breaking Changes-20220923-112314.yaml * Update dev-requirements.txt * remove current_timestamp_in_utc * fix backcompat * change test import * fix BaseCurrentTimestamps import * update dev-requirements * Update change log body * fix changie log (cherry picked from commit 2ef59aa)
* consolidate timestamp macros * add testing changes * deleting extra timestamps.sql * changie entry * fix backcompat * Update Breaking Changes-20220923-112314.yaml * Update dev-requirements.txt * remove current_timestamp_in_utc * fix backcompat * change test import * fix BaseCurrentTimestamps import * update dev-requirements * Update change log body * fix changie log (cherry picked from commit 2ef59aa) Co-authored-by: colin-rogers-dbt <[email protected]>
resolves #276
Description
Checklist
changie new
to create a changelog entry