Skip to content
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

Use getdate instead of current_timestamp #171

Merged
merged 2 commits into from
Dec 4, 2019
Merged

Use getdate instead of current_timestamp #171

merged 2 commits into from
Dec 4, 2019

Conversation

tjengel
Copy link
Contributor

@tjengel tjengel commented Oct 27, 2019

This pr fixes issue #109

@@ -3,7 +3,7 @@
{% endmacro %}

{% macro default__current_timestamp() %}
current_timestamp::{{dbt_utils.type_timestamp()}}
getdate()::{{dbt_utils.type_timestamp()}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll want to preserve current_timestamp in the default implementation, but you can totally provide a redshift-specific implementation similar to the bigquery one below. That could just look like:

{% macro redshift__current_timestamp() %}
  getdate()::{{dbt_utils.type_timestamp()}}
{% endmacro %}

The default implementation here is going to be used by other databases like Snowflake and Postgres which do not (AFAIK) support the getdate() function.

@drewbanin
Copy link
Contributor

Thanks for making this PR @tjengel! I just made a quick comment - once that's addressed I can kick off a CI build here :D

@tjengel
Copy link
Contributor Author

tjengel commented Oct 29, 2019

@drewbanin I was starting to suspect I'd need to go that route. I found the sample profiles.yml file. What do I need to do to get that setup to run the tests locally?

@drewbanin
Copy link
Contributor

We have some (admittedly very light) docs for this over here: https://github.com/fishtown-analytics/dbt-utils/tree/master/integration_tests

You'll want to configure a profile: in your ~/.dbt/profiles.yml file named integration_tests, and then you'll want to define a target in that profile called redshift.

Once that's done, you can try running make test-redshift from the integration_tests directory. That should kick off a dbt compile, seed, run, and test in order.

That sample profiles.yml file you're referencing (this one, right is used in CI builds - you won't actually want to put your credentials in there! Always keep your creds outside of git repos -- the ~/.dbt/profiles.yml is located really far away from dbt project code to make sure it never gets committed by accident :D

Let me know if there's anything else I can help out with here

@drewbanin
Copy link
Contributor

This CI build failed because of an issue with the snowflake-connector-python library. I just kicked off a new build to see if that fixes things. Once the tests pass, this will be ready to merge!

@drewbanin
Copy link
Contributor

We're going to cut an 0.14.4 release of dbt which addresses this Snowflake issue - going to re-run this once that version is live.

@clrcrl clrcrl merged commit 6e5e5cd into dbt-labs:master Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants