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

dbt 1.9 migration #272

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions dbt/include/dremio/macros/adapters/snapshot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,34 @@ limitations under the License.*/


{% macro dremio__snapshot_merge_sql(target, source, insert_cols) -%}
{%- set columns = config.get("snapshot_table_column_names") or get_snapshot_table_column_names() -%}
{%- set insert_cols_csv = insert_cols | join(', ') -%}

merge into {{ target }} as DBT_INTERNAL_DEST
using {{ source }} as DBT_INTERNAL_SOURCE
on DBT_INTERNAL_SOURCE.dbt_scd_id = DBT_INTERNAL_DEST.dbt_scd_id
on DBT_INTERNAL_SOURCE.{{ columns.dbt_scd_id }} = DBT_INTERNAL_DEST.{{ columns.dbt_scd_id }}

when matched
then update
set dbt_valid_to = DBT_INTERNAL_SOURCE.dbt_valid_to
{%- if config.get("dbt_valid_to_current") %}
and (
DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} = {{ config.get('dbt_valid_to_current') }}
or DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} is null
)
{%- else %}
and DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} is null
{%- endif %}
and DBT_INTERNAL_SOURCE.dbt_change_type in ('update','delete')
then update
set {{ columns.dbt_valid_to }} = DBT_INTERNAL_SOURCE.{{ columns.dbt_valid_to }}

when not matched
then insert ({{ insert_cols_csv }})
values
({% for column_name in insert_cols -%}
DBT_INTERNAL_SOURCE.{{ column_name }}
{%- if not loop.last %}, {%- endif %}
{%- endfor %})

and DBT_INTERNAL_SOURCE.dbt_change_type = 'insert'
then insert ({{ insert_cols_csv }})
values
(
{%- for column_name in insert_cols -%}
DBT_INTERNAL_SOURCE.{{ column_name }}{% if not loop.last %}, {% endif %}
{%- endfor %}
)
;
{% endmacro %}
4 changes: 2 additions & 2 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Babel==2.12.1
betterproto==1.2.5
certifi==2023.7.22
charset-normalizer==3.1.0
dbt-core==1.8.8
dbt-tests-adapter==1.8.0
dbt-core==1.9.1
dbt-tests-adapter==1.10.1
python-dotenv==1.0.1
exceptiongroup==1.1.1
future==0.18.3
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

package_name = "dbt-dremio"

package_version = "1.8.1"
package_version = "1.9.0"

description = """The Dremio adapter plugin for dbt"""

Expand All @@ -37,8 +37,9 @@
packages=find_namespace_packages(include=["dbt", "dbt.*"]),
include_package_data=True,
install_requires=[
"dbt-core>=1.8",
"dbt-adapters>=1.0.0, <2.0.0",
"dbt-core>=1.9",
"dbt-common>=1.14.0,<2.0",
"dbt-adapters>=1.10.4,<2.0",
"requests>=2.31.0",
],
classifiers=[
Expand Down
Loading