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

[ADAP-920] [ADAP-919] [Bug] Delta table metadata changed/concurrent update #892

Open
2 tasks done
colin-rogers-dbt opened this issue Sep 25, 2023 · 2 comments
Open
2 tasks done
Labels
bug Something isn't working Stale

Comments

@colin-rogers-dbt
Copy link
Contributor

Is this a new bug in dbt-spark?

  • I believe this is a new bug in dbt-spark
  • I have searched the existing issues, and I could not find an existing issue for this bug

Current Behavior

Seeing intermittent issues with executing delta tables on v1.4:
Error from server: error code: \'0\' error message: \'org.apache.hive.service.cli.HiveSQLException: Error running query: io.delta.exceptions.MetadataChangedException: The metadata of the Delta table has been changed by a concurrent update. Please try the operation

Expected Behavior

succeeds

Steps To Reproduce

TBD

Relevant log output

No response

Environment

- OS:
- Python:
- dbt-core:
- dbt-spark:

Additional Context

No response

@colin-rogers-dbt colin-rogers-dbt added bug Something isn't working triage labels Sep 25, 2023
@github-actions github-actions bot changed the title [Bug] Delta table metadata changed/concurrent update [ADAP-919] [Bug] Delta table metadata changed/concurrent update Sep 25, 2023
@github-actions github-actions bot changed the title [ADAP-919] [Bug] Delta table metadata changed/concurrent update [ADAP-920] [ADAP-919] [Bug] Delta table metadata changed/concurrent update Sep 25, 2023
@jeremyyeo
Copy link

For anyone else running into this - we would love to collect additional anecdata.

  1. Modify the default query_comment macro:
-- macros/query_comment.sql

{% macro query_comment(node) %}
    {%- set comment_dict = {} -%}
    {%- do comment_dict.update(
        app='dbt',
        dbt_version=dbt_version,
        profile_name=target.get('profile_name'),
        target_name=target.get('target_name'),
        dbt_invocation_id=invocation_id,
        dbt_cloud_job_id=env_var('DBT_CLOUD_JOB_ID', 'not-a-dbt-cloud-job'),
        dbt_cloud_run_id=env_var('DBT_CLOUD_RUN_ID', 'not-a-dbt-cloud-run')
    ) -%}
    {%- if node is not none -%}
      {%- do comment_dict.update(
        file=node.original_file_path,
        node_id=node.unique_id,
        node_name=node.name,
        resource_type=node.resource_type,
        package_name=node.package_name,
        relation={
            "database": node.database,
            "schema": node.schema,
            "identifier": node.identifier
        }
      ) -%}
    {% else %}
      {%- do comment_dict.update(node_id='internal') -%}
    {%- endif -%}
    {% do return(tojson(comment_dict)) %}
{% endmacro %}
  1. Use it in dbt_project.yml
# dbt_project.yml

name: my_dbt_project
config-version: 2
version: 1.0

models:
  my_dbt_project:
    +materialized: table

query-comment: "{{ query_comment(node) }}"

The query comment should then show up as a SQL comment in the query history and indicate which dbt Cloud run / job or dbt invocation a particular duplicated DDL is tied to.

@dbeatty10 dbeatty10 removed the triage label Feb 7, 2024
@mikealfare mikealfare removed the jira label Feb 7, 2024
Copy link
Contributor

github-actions bot commented Aug 6, 2024

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

4 participants