Skip to content

Commit

Permalink
Merge branch 'main' into prep-release/1.9.0b1_11132192713
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare authored Oct 16, 2024
2 parents 6ad2301 + 805a08e commit 85eda9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changes/unreleased/Features-20240927-133927.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
kind: Features
body: Enable setting current value of dbt_valid_to
time: 2024-09-27T13:39:27.268886-04:00
custom:
Author: gshank
Issue: "1112"
7 changes: 6 additions & 1 deletion dbt/include/spark/macros/materializations/snapshot.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
{% endif %}
on DBT_INTERNAL_SOURCE.{{ columns.dbt_scd_id }} = DBT_INTERNAL_DEST.{{ columns.dbt_scd_id }}
when matched
and DBT_INTERNAL_DEST.{{ columns.dbt_valid_to }} is null
{% 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 }}
Expand Down
8 changes: 6 additions & 2 deletions tests/functional/adapter/test_python_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def model(dbt, spark):
"ResourceClass": "SingleNode"
}
},
packages=['spacy', 'torch', 'pydantic>=1.10.8']
packages=['spacy', 'torch', 'pydantic>=1.10.8', 'numpy<2']
)
data = [[1,2]] * 10
return spark.createDataFrame(data, schema=['test', 'test2'])
Expand All @@ -85,7 +85,11 @@ def model(dbt, spark):


@pytest.mark.skip_profile(
"apache_spark", "spark_session", "databricks_sql_endpoint", "spark_http_odbc"
"apache_spark",
"spark_session",
"databricks_sql_endpoint",
"spark_http_odbc",
"databricks_http_cluster",
)
class TestChangingSchemaSpark:
"""
Expand Down

0 comments on commit 85eda9a

Please sign in to comment.