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

insert+overwrite incremental strategy for iceberg tables incorrectly uses a partition clause #204

Open
amaralvieira opened this issue Sep 4, 2024 · 0 comments

Comments

@amaralvieira
Copy link

amaralvieira commented Sep 4, 2024

From the docs:

Since Iceberg uses hidden partitioning it means you don't need a partition clause in your INSERT statements.

The current get_insert_overwrite_sql macro throws an error whenever the iceberg table uses partition transforms. This can be avoided altogether by omitting the partition clause. For example:

    {% if table_type == 'iceberg' -%}
        {%- if raw_strategy == 'insert_overwrite' %}
            insert overwrite {{ target }} ({{ dest_cols_csv }})
            select {{ dest_cols_csv }} from {{ source }}
        {%- elif raw_strategy == 'append' %}
            insert into {{ target }} ({{ dest_cols_csv }})
            select {{ dest_cols_csv }} from {{ source }}
        {%- endif %}
    {% else %}

It would probably be a good idea to add a check somewhere for the case someone tries to set a INSERT OVERWRITE incremental strategy for tables that use the BUCKET transform (as it is not allowed).

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

No branches or pull requests

1 participant