sai_tai
07/08/2021, 1:48 PMwith cam as (
SELECT *
FROM {{ref('adwords_ads')}} -- This can find the model, but not the table in the DB..
),
Does anyone know what I should do? The only solution that I can think of is changing the raw table name..visch
07/08/2021, 2:13 PMdbt ls
the model adwords_ads
exists in the list right?
if you make a test model
select * from {{ ref('adwords_accounts`) }}
Whats the error the you get?visch
07/08/2021, 2:15 PMsai_tai
07/08/2021, 2:29 PMmeltano invoke dbt ls --resource-type=model
# Return
my_meltano_project.tap_adwords
tap_adwords.transform.adwords_account_stats_per_day
tap_adwords.transform.adwords_account_stats_per_day_segments
tap_adwords.transform.adwords_account_stats_per_month
tap_adwords.transform.adwords_account_stats_per_month_segments
tap_adwords.transform.adwords_account_stats_per_week
tap_adwords.base.adwords_accounts
tap_adwords.base.adwords_ad_groups
tap_adwords.base.adwords_ad_report
tap_adwords.transform.adwords_ad_stats_per_day
tap_adwords.transform.adwords_ad_stats_per_month
tap_adwords.transform.adwords_ad_stats_per_week
tap_adwords.transform.adwords_adgroup_stats_per_day
tap_adwords.transform.adwords_adgroup_stats_per_day_segments
tap_adwords.transform.adwords_adgroup_stats_per_month
tap_adwords.transform.adwords_adgroup_stats_per_month_segments
tap_adwords.transform.adwords_adgroup_stats_per_week
tap_adwords.base.adwords_ads
tap_adwords.transform.adwords_campaign_stats_per_day
tap_adwords.transform.adwords_campaign_stats_per_day_segments
tap_adwords.transform.adwords_campaign_stats_per_month
tap_adwords.transform.adwords_campaign_stats_per_month_segments
tap_adwords.transform.adwords_campaign_stats_per_week
tap_adwords.base.adwords_campaigns
....
I got this message when I make a test model as you said.
Runtime Error in model tap_adwords (models/tap_adwords.sql)
com.facebook.presto.v217.sql.analyzer.SemanticException: line 8:10: Table 638835835266.MY_DATA_BASE.adwords_ads does not exist
visch
07/08/2021, 2:51 PMselect * from {{ ref('adwords_ads`) }}
You ran the command?
meltano invoke dbt -m adwords_ads
I'd assume even running with the models needed for adwords_ads to be built fails so?
meltano invoke dbt -m +adwords_ads
So the target_relation for the model adwords_ads
isn't pointing to the tap_adwords.base.adwords_ads
table as you'd expect? Hmm I vaugely remember something like this when I ran through using a dbt model ages ago.visch
07/08/2021, 2:52 PMedgar_ramirez_mondragon
07/08/2021, 3:01 PMMY_DATA_BASE
it seems) in your dbt_projecy.yml
:
models:
tap_adwords:
vars:
schema: 'MY_DATA_BASE'
sai_tai
07/08/2021, 3:07 PMdbt_project.yml
models:
my_meltano_project: null
tap_adwords: {}
tap_google_analytics: {}
tap_facebook: {}
vars:
tap_adwords:
schema: '{{ env_var(''DBT_SOURCE_SCHEMA'') }}'
tap_google_analytics:
schema: '{{ env_var(''DBT_SOURCE_SCHEMA'') }}'
tap_facebook:
schema: '{{ env_var(''DBT_SOURCE_SCHEMA'') }}'
sai_tai
07/08/2021, 3:08 PMsai_tai
07/08/2021, 3:14 PMvisch
07/08/2021, 3:16 PMvisch
07/08/2021, 3:17 PMsai_tai
07/08/2021, 3:27 PMmeltano --log-level=debug elt tap-adwords target-athena --transform=run --job_id=adwords-to-athena
sai_tai
07/08/2021, 3:35 PMvisch
07/08/2021, 3:39 PMref
your model, The relation (https://docs.getdbt.com/reference/dbt-classes#relation) needs to return the right table as that's what gets inserted into your sql.
When you let DBT build the tables, does the test model we talk about work?
meltano invoke dbt -m +adwords_ads
visch
07/08/2021, 3:40 PMsai_tai
07/08/2021, 4:04 PMmeltano invoke dbt run -m adwords_ads
Running with dbt=0.19.1
Found 80 models, 0 tests, 0 snapshots, 0 analyses, 147 macros, 0 operations, 0 seed files, 0 sources, 0 exposures
16:45:54 | Concurrency: 4 threads (target='athena')
16:45:54 |
16:45:54 | 1 of 1 START table model MY_DB.adwords_ads.................... [RUN]
16:45:55 | 1 of 1 ERROR creating table model MY_DB.adwords_ads........... [ERROR in 0.53s]
16:45:55 |
16:45:55 | Finished running 1 table model in 6.06s.
Completed with 1 error and 0 warnings:
Runtime Error in model adwords_ads (models/base/adwords_ads.sql)
An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 20:9: identifiers must not contain ':'
sai_tai
07/08/2021, 4:09 PMmeltano elt tap-adwords target-athena --transform=run --job_id=adwords-to-athena
sai_tai
07/08/2021, 4:10 PMdbt |
dbt | Runtime Error in model adwords_ads (models/base/adwords_ads.sql)
dbt | An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 20:9: identifiers must not contain ':'
dbt |
dbt | Runtime Error in model adwords_ad_report (models/base/adwords_ad_report.sql)
dbt | An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 34:9: identifiers must not contain ':'
dbt |
dbt | Runtime Error in model adwords_keywords_report (models/base/adwords_keywords_report.sql)
dbt | An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 34:9: identifiers must not contain ':'
dbt |
dbt | Runtime Error in model adwords_campaigns (models/base/adwords_campaigns.sql)
dbt | An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 23:9: identifiers must not contain ':'
dbt |
dbt | Runtime Error in model adwords_ad_groups (models/base/adwords_ad_groups.sql)
dbt | An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 23:9: identifiers must not contain ':'
visch
07/08/2021, 4:18 PMRuntime Error in model adwords_ads (models/base/adwords_ads.sql)
An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: line 20:9: identifiers must not contain ':'
Is a new one! Looks to me that https://gitlab.com/meltano/dbt-tap-adwords/-/blob/master/models/base/adwords_ads.sql#L12 isn't valid for all SQL adapters. Double colon is commonnly available in a lot of DBs / DWs but not all.
I have to get back to my normal stuff lunch is over. I hope for the best I'll watch over this and try to send something later to help!
From this point it depends on what you're after. If it's just a prototype I'd look into setting up a sources file https://docs.getdbt.com/docs/building-a-dbt-project/using-sources
If it's to get this working, I'd copy the files from https://gitlab.com/meltano/dbt-tap-adwords/-/tree/master the models directory and build the models that you care about yourself tweaking them for your db.
All of this advice could be moot as I'm not a super expert in this stuff either, just have some experience in it 😄edgar_ramirez_mondragon
07/08/2021, 4:23 PMsai_tai
07/08/2021, 11:38 PMsai_tai
07/08/2021, 11:38 PMbase_campaignid
in the SQL file is baseCampaignId
in the document. Is there any place I can set the variable convention or it is just the code is not updated?
-- The original file
with source as (
select * from {{var('schema')}}.campaigns
),
renamed as (
select
-- PK
id as campaign_id,
-- FKeys
-- _sdc_customer_id::bigint as account_id,
Cast("_sdc_customer_id" as bigint) as account_id,
base_campaignid as base_campaign_id,
budget_id as budget_id,
-- Campaign Info
name as campaign_name,
status as campaign_status,
serving_status as serving_status,
ad_serving_optimization_status as optimization_status,
advertising_channel_type as advertising_channel_type,
campaign_trial_type as trial_type,
start_date as start_at,
end_date as end_at,
-- JSONB arrays in case we need them to filter by label or setting value
labels as labels,
settings as settings
from source
)
visch
07/09/2021, 12:49 AM