Git Product home page Git Product logo

Comments (7)

drewbanin avatar drewbanin commented on August 20, 2024

right on @darrenhaken - this would be a great change. Let us know if you're interested in contributing a change for the feature! I think the change will be self-contained within the BigQuery materialization code

from dbt-bigquery.

darrenhaken avatar darrenhaken commented on August 20, 2024

I'd be interested in working on it. Can you sign post where the change would need to go?

from dbt-bigquery.

drewbanin avatar drewbanin commented on August 20, 2024

Sure thing - I think we'll want to:

  1. Add a macro in plugins/bigquery/.../adapter.sql that runs something like
    alter table {{table}} set options (labels=...)
  2. Call that macro in the incremental materialization, but only if the model is building incrementally. That code should go somewhere around here.
    • I think we should leave the existing code that sets the labels option in create_table_as and create_view_as statements as-is. See here and here

I can dig deeper into this if you'd benefit from any more direction, but those should be the general places to check out!

from dbt-bigquery.

yu-iskw avatar yu-iskw commented on August 20, 2024

I think the issue applies to snapshots in BigQuery.

from dbt-bigquery.

dgreen161 avatar dgreen161 commented on August 20, 2024

@drewbanin @jtcohen6 I've got a version of this working where the labels config replaces what is already on the table.

One difference to the other materialization options is the case when all the labels have been removed. What should the behaviour be in this case? Looking at the BigQuery documentation, you aren't able to remove all the labels with SQL, you have to have at least one for it to work. You can have at least one label but removing them all can't be done, only with Python in this case.

Doing it within SQL, I see two options.

  1. Update the labels with a blank i.e. no_labels = true. This would remove all the previous labels but would require a dummy label to be put back in it's place which would stay until a --full-refresh is triggered.

Screenshot 2022-02-27 at 14 20 55

  1. Not updating the labels at all, leaving them all intact. This is my least favourite of the two since it wouldn't be possible to ever remove all the labels (until of course a --full-refresh is triggered). Despite this being my least favourite, it wouldn't be a regression on the current capabilities.

If done in Python, I think it would be a case of getting fetching all the labels in the table and then subsequently setting them all to None like this. If this was the prefered option, I might require some assistance to get this working.

from dbt-bigquery.

github-actions avatar github-actions commented on August 20, 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 remove the stale label or comment on the issue, or it will be closed in 7 days.

from dbt-bigquery.

jeremygzva avatar jeremygzva commented on August 20, 2024

Hey there,
Has this issue been solved?

from dbt-bigquery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.