rittmananalytics / droughty

Droughty helps keep your workflow dry
https://droughty.readthedocs.io/en/latest/
MIT License
62 stars 6 forks source link

Don't generate a set if there are only pk and fk columns in the table #32

Closed Terroface closed 1 year ago

Terroface commented 2 years ago

Bug: The scenario mentioned in the heading causes the preceding table's columns to apply to the current table and the set name to be blank

sgeef commented 1 year ago

I believe to have found this same issue:

LookML generated

view: wh_cs__external_events_university_bridge {
sql_table_name: wh_cs__external_events_university_bridge ;;
set: {
  fields: [external_event_key, external_event_name, external_event_platform_instance]
}

generated from:

final as (

    select

        {{dbt_utils.surrogate_key (
            ['external_events_university_bridge_compound_key']
        )}} as external_events_university_bridge_pk,

        case when external_event_key is not null then
        {{dbt_utils.surrogate_key (
            ['external_event_key']
        )}} end as external_event_fk,

        case when university_natural_key is not null then
        {{dbt_utils.surrogate_key (
            ['university_natural_key']
        )}} end as university_fk,
    from
        source

)
Screenshot 2022-11-28 at 00 29 11

Is there a workaround for this issue?

LewisCharlesBaker commented 1 year ago

@Terroface This PR https://github.com/LewisCharlesBaker/droughty/pull/41 resolved this issue.

@sgeef - Update to droughty 0.8.1 for the fix 👍