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

fix: 修复增量同步时的类型转换问题 #8

Merged
merged 1 commit into from
Jan 13, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,24 @@
{{ create_table_as_internal(False, target_relation, sql, True, partition_config=partition_by) }}
{%- endcall -%}
{% else %}
{% set tmp_relation_exists = false %}
{% set temp_relation_exists = false %}
{% if on_schema_change != 'ignore' %}
{#-- Check first, since otherwise we may not build a temp table --#}
{#-- Python always needs to create a temp table --#}
{%- call statement('create_tmp_relation') -%}
{{ create_table_as_internal(True, tmp_relation, sql, True, partition_config=partition_by) }}
{%- call statement('create_temp_relation') -%}
{{ create_table_as_internal(True, temp_relation, sql, True, partition_config=partition_by) }}
{%- endcall -%}
{% set tmp_relation_exists = true %}
{% set temp_relation_exists = true %}
{#-- Process schema changes. Returns dict of changes if successful. Use source columns for upserting/merging --#}
{% set dest_columns = process_schema_changes(on_schema_change, tmp_relation, existing_relation) %}
{% set dest_columns = process_schema_changes(on_schema_change, temp_relation, existing_relation) %}
{% endif %}

{% if not dest_columns %}
{% set dest_columns = adapter.get_columns_in_relation(existing_relation) %}
{% endif %}

{% set build_sql = mc_generate_incremental_build_sql(
incremental_strategy, temp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, tmp_relation_exists, incremental_predicates
incremental_strategy, temp_relation, target_relation, sql, unique_key, partition_by, partitions, dest_columns, temp_relation_exists, incremental_predicates
) %}

{% call statement("main") %}
Expand Down
2 changes: 1 addition & 1 deletion dbt/include/maxcompute/macros/utils/date_spine.sql
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

select *
from all_periods
where datediff(date_{{datepart}}, {{ end_date }}) <= 0
where cast(date_{{datepart}} as timestamp) <= cast({{ end_date }} as timestamp)

)

Expand Down
Loading