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

Add 'duckdb' support #67

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ericmichael
Copy link

@ericmichael ericmichael commented Aug 7, 2023

Please provide your name and company

Eric Martinez, 80/20 Jiu-Jitsu

Link the issue/feature request which this PR is meant to address

#66

Detail what changes this PR introduces and how this addresses the issue/feature request linked above.
I encountered an error related to the + operator not being supported for adding an interval to a string in DuckDB.

The specific issue arises in the int_stripe__date_spine.sql model, where the dbt.dateadd function tries to add 1 day to the last_date_adjust variable, which is a string. This operation is not supported in DuckDB, causing the model to fail.

Since DuckDB uses Postgres syntax, we can simply handle it in the same way as Postgres is handled.

How did you validate the changes introduced within this PR?
Validated locally. Additional changes may be required.

Which warehouse did you use to develop these changes?
DuckDB.

Did you update the CHANGELOG?

  • Yes

Did you update the dbt_project.yml files with the version upgrade (please leverage standard semantic versioning)? (In both your main project and integration_tests)

  • Yes

Provide an emoji that best describes your current mood

💃

Feedback

We are so excited you decided to contribute to the Fivetran community dbt package! We continue to work to improve the packages and would greatly appreciate your feedback on our existing dbt packages or what you'd like to see next.

PR Template

@ericmichael ericmichael changed the title Add 'duckdb' support in date_spline code Add 'duckdb' support Aug 7, 2023
Copy link
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

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

@ericmichael thanks for opening this PR! As @elanfivetran mentioned in his response to your initial issue #67 we welcome this contribution and your efforts to update the package to be compatible with DuckDB. However, we do not feel comfortable claiming that the package is fully compatible with DuckDB since we do not have the backend infrastructure to test DuckDB compatibility with our integration tests at the moment.

As such, I would be open to approving and merging this PR. However, we will not claim we support DuckDB until we build it out in our backend integration testing pipeline. If that works for you, I have a few suggestions to be applied to your PR. Once these are applied this should be good to approve and merge!

@@ -7,7 +7,7 @@ with spine as (
{% endset %}
{% set first_date = run_query(first_date_query).columns[0][0]|string %}

{% if target.type == 'postgres' %}
{% if target.type == 'postgres' or target.type == 'duckdb' %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Small suggestion to combine postgres and duckdb in the same conditional check.

Suggested change
{% if target.type == 'postgres' or target.type == 'duckdb' %}
{% if target.type in ('postgres', 'duckdb') %}

@@ -34,7 +34,7 @@ with spine as (
{% else %} {% set last_date = run_query(current_date_query).columns[0][0]|string %}
{% endif %}

{% if target.type == 'postgres' %}
{% if target.type == 'postgres' or target.type == 'duckdb' %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% if target.type == 'postgres' or target.type == 'duckdb' %}
{% if target.type in ('postgres', 'duckdb') %}

@@ -1,3 +1,10 @@
# dbt_stripe v0.10.2
## 🎉 Feature Updates
- Included support for DuckDB via ([#67](https://github.com/fivetran/dbt_stripe/pull/67))
Copy link
Contributor

Choose a reason for hiding this comment

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

I am a bit cautious to boldly claim that this package is compatible with DuckDB since we do not have the infrastructure on our end to validate that this does in fact work for DuckDB destinations.

I would request we change the wording of the CHANGELOG entry to reflect this approach. My thoughts are something along the following:

Suggested change
- Included support for DuckDB via ([#67](https://github.com/fivetran/dbt_stripe/pull/67))
- Included DuckDB destination in conditional logic within the `int_stripe__date_spine` model. ([#67](https://github.com/fivetran/dbt_stripe/pull/67))

We can then claim proudly that we support DuckDB once we have it as part of our integration testing pipeline. However, for now this should be good!

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.

2 participants