The problem I’m having
adapter.get_columns_in_relation() returns list of empty strings
The context of why I’m trying to do this
dbt cloud with bigquery
What I’ve already tried
attempted to call the macro on “this” and on a catalog of different models of different materialization
attempted to run the table from prod and from dev , no avail.
Some example code or error messages
{{
config(
enabled=true,
tags=["mni","schedule_every_day_at_7","articleid_fix"],
database="prod-database",
schema="reports",
alias="rep_whatsapp_channels_view_test",
materialized = 'table'
)
}}
{%- set columns = adapter.get_columns_in_relation(this) -%}
{% for column in columns %}
{{ log("Column: " ~ column, info=true) }}
{% endfor %}
with base_data as(
select
*
from
{{ ref('rep_whatsapp_channels_view') }}
),
reaggregation as(
select
date,
derived_tstamp,
portal,
publisher_group,
articleid as articleid,
markt,
mkt_campaign,
page_urlpath,
page_title,
device_category,
medium,
source,
traffic_source,
sum(unique_users) as unique_users,
sum(unique_subscribers) as unique_subscribers,
sum(pageviews) as pageviews,
sum(bounces) as bounces,
sum(media_time) media_time,
sum(visits) as visits,
from base_data
{{ dbt_utils.group_by(13) }}
)
select
*
from
reaggregation
returns
11:31:28 1 of 1 START sql table model dev_mni_reports.rep_whatsapp_channels_view_test ... [RUN]
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:28 Column:
11:31:36 1 of 1 OK created sql table model dev_mni_reports.rep_whatsapp_channels_view_test [CREATE TABLE (530.6k rows, 151.5 MiB processed) in 7.69s]
if i’m hitting the download logs button, or the copy logs button, the columns are returned just fine.
not entirely sure whether this is just a display / logging bug , or whether this is something more serious.
edit:
it seems to work just fine when looping over column.name
seems like the log output in dbt cloud has some issues displaying “BigQueryColumn” objects.