The problem I’m having
dbt run command fails
The context of why I’m trying to do this
I’m learning dbt with BigQuery connection and following the tutorial
What I’ve already tried
copying the data table ID from BiqQuery into the dbl query:
my_firstdbt_model_sql:
select * from
woofstr-7a206.datasetOne.tableone limit 1000
my_second_dbt_model_sql:
-- Use the
ref` function to select from other models
select *
from {{ ref(‘woofstr-7a206.datasetOne.tableone’) }}
where id = 1`
Some example code or error messages
`07:13:33 Began running node model.my_new_project.my_second_dbt_model
07:13:33 2 of 2 START sql view model dbt_drhodes.my_second_dbt_model … [RUN]
07:13:33 Acquiring new bigquery connection ‘model.my_new_project.my_second_dbt_model’
07:13:33 Began compiling node model.my_new_project.my_second_dbt_model
07:13:33 Writing injected SQL for node “model.my_new_project.my_second_dbt_model”
07:13:33 Timing info for model.my_new_project.my_second_dbt_model (compile): 2023-02-18 07:13:33.031174 => 2023-02-18 07:13:33.044240
07:13:33 Began executing node model.my_new_project.my_second_dbt_model
07:13:33 Writing runtime sql for node “model.my_new_project.my_second_dbt_model”
07:13:33 Opening a new connection, currently in state init
07:13:33 On model.my_new_project.my_second_dbt_model: /* {“app”: “dbt”, “dbt_version”: “1.4.1”, “profile_name”: “user”, “target_name”: “default”, “node_id”: “model.my_new_project.my_second_dbt_model”} */
create or replace view woofstr-7a206
.dbt_drhodes
.my_second_dbt_model
OPTIONS()
as – Use the ref
function to select from other models
select *
from woofstr-7a206
.dbt_drhodes
.my_first_dbt_model
where id = 1;
07:13:33 BigQuery adapter: Retry attempt 1 of 1 after error: BadRequest(‘Unrecognized name: id at [10:7]’)
07:13:35 BigQuery adapter: https://console.cloud.google.com/bigquery?project=woofstr-7a206&j=bq:US:1f2e02c4-6540-43b2-9bf0-1cae9995eab1&page=queryresults
07:13:35 Timing info for model.my_new_project.my_second_dbt_model (execute): 2023-02-18 07:13:33.044667 => 2023-02-18 07:13:35.166480
07:13:35 Database Error in model my_second_dbt_model (models/example/my_second_dbt_model.sql)
Unrecognized name: id at [10:7]
compiled Code at target/run/my_new_project/models/example/my_second_dbt_model.sql
07:13:35 Sending event: {‘category’: ‘dbt’, ‘action’: ‘run_model’, ‘label’: ‘f7527181-a24f-4b70-b5ac-eae91acc03a8’, ‘context’: [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f3afe94fb50>]}
07:13:35 2 of 2 ERROR creating sql view model dbt_drhodes.my_second_dbt_model … [ERROR in 2.14s]
07:13:35 Finished running node model.my_new_project.my_second_dbt_model`
Put code inside backticks
to preserve indentation
which is especially important
for Python and YAML!