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

implementation guideline #468

Closed
wants to merge 19 commits into from

Conversation

dataders
Copy link
Contributor

@dataders dataders commented Sep 29, 2023

Resolves #
Depends on: #471

Description

mostly worked on the python class tuff

  • applied state
  • relation-specific drop and rename
  • modify materializations according to above
  • (not all the way done yet) Python class configs
  • new MV tests

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md and added information about my change to the "dbt-databricks next" section.

@benc-db
Copy link
Collaborator

benc-db commented Sep 29, 2023

Please see tests failing re: hologram removal.

@benc-db
Copy link
Collaborator

benc-db commented Oct 2, 2023

@dataders is this ready for me to take over or do you still plan on another commit?

@dataders
Copy link
Contributor Author

dataders commented Oct 2, 2023

@dataders is this ready for me to take over or do you still plan on another commit?

not even close. 🥲 i'll be working on this more today and tomorrow. stay tuned.

also dbt-spark 1.6.0b2 (which includes the hologram work dbt-labs/dbt-spark#880) is being cut as we speak. this'll obviate my most recent commit

@dataders dataders force-pushed the mikanders_1.7.0 branch 2 times, most recently from 51ecbae to 142c3fb Compare October 2, 2023 21:09
@dataders dataders marked this pull request as draft October 3, 2023 14:48
Comment on lines 11 to 28
sql = f"""
select
'table' as relation_type
from pg_tables
where schemaname = '{relation.schema}'
and tablename = '{relation.identifier}'
union all
select
case
when definition ilike '%create materialized view%'
then 'materialized_view'
else 'view'
end as relation_type
from pg_views
where schemaname = '{relation.schema}'
and viewname = '{relation.identifier}'
"""
results = project.run_sql(sql, fetch="all")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikealfare how can I change this to use list_relations_without_caching() instead? in my mind that's where this logic is already standardized.

in the case of dbt-databricks, it all the logic is in Python ( DatabricksAdapter.get_relations_without_caching(). I'd rather not duplicate/reimplement it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the meantime, i suppose this is a decent woraround

    select
        'table' as relation_type
    from information_schema.tables
    where schemaname = '{relation.schema}'
    and tablename = '{relation.identifier}'
    union all
    select
        case when
            is_materialized = TRUE then 'materialized_view'
            else 'view'
        end as relation_type
    from information_schema.views
    where schemaname = '{relation.schema}'
    and viewname = '{relation.identifier}'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So long as its only used with the UC cluster...information schema isn't available on the non-uc cluster.

@benc-db
Copy link
Collaborator

benc-db commented Oct 5, 2023

@dataders status update? At any point feel free to hand off and give me instructions on what is remaining :).

@dataders
Copy link
Contributor Author

dataders commented Oct 5, 2023

@dataders status update? At any point feel free to hand off and give me instructions on what is remaining :).
@benc-db ask and you shall receive :) #473

@benc-db
Copy link
Collaborator

benc-db commented Oct 5, 2023

@dataders status update? At any point feel free to hand off and give me instructions on what is remaining :).

you @benc-db ask and you shall receive :) #473

Ok, taking it now.

@dataders
Copy link
Contributor Author

@benc-db, after discussing internally, we're dropping this MV refactor work as a requirement for 1.7.0rc1 or even 1.7.0, but since you already have your hands on it, I wanted to show the next step. I was afraid to push directly to the branch in this PR, so I made dataders#1 that you can pull in if you like. #477 gives more context

@benc-db benc-db closed this Jan 5, 2024
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

Successfully merging this pull request may close these issues.

2 participants