# dbt run create bigquery view and not table

**URL:** <https://discourse.getdbt.com/t/dbt-run-create-bigquery-view-and-not-table/10135>\
**Category:** Help\
**Tags:** bigquery, dbt-core\
**Created:** [September 28, 2023, 12:56pm UTC](https://discourse.getdbt.com/t/dbt-run-create-bigquery-view-and-not-table/10135 "2023-09-28T12:56:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aalshikh](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@aalshikh](https://discourse.getdbt.com/u/aalshikh)\
**Post date:** [September 28, 2023, 12:56pm UTC](https://discourse.getdbt.com/t/dbt-run-create-bigquery-view-and-not-table/10135/1 "2023-09-28T12:56:46Z")

</div>

Hello,

my need is the following:  
I have bigquery datasets containing tables in a project.  
I want to retrieve one of these tables, create a model for it and create a new table in a new dataset, resulting from this model.

I currently work locally. Here is the tree structure of my dbt project :

.  
├── logs  
│ └── dbt.log  
└── my\_project\_dbt  
├── README.md  
├── analyses  
├── dbt\_packages  
├── dbt\_project.yml  
├── logs  
│ └── dbt.log  
├── macros  
├── models  
│ ├── dbt\_packages  
│ └── my\_sql\_file.sql  
├── seeds  
├── snapshots  
├── target  
│ ├── compiled  
│ │ └── mon\_projet\_dbt  
│ │ └── models  
│ │ └── my\_model.sql  
│ ├── graph.gpickle  
│ ├── graph\_summary.json  
│ ├── manifest.json  
│ ├── partial\_parse.msgpack  
│ ├── run  
│ │ └── mon\_projet\_dbt  
│ │ └── models  
│ │ └── my\_model.sql  
│ ├── run\_results.json  
│ └── semantic\_manifest.json  
└── tests

And below are the files I used.

my\_sql\_file.sql :

> WITH my\_model AS (  
> SELECT  
> REGEXP\_EXTRACT(STUDYID, r’CL(.\*)') AS extracted\_content  
> FROM  
> `my_project.sas_test.ta`  
> )  
> SELECT  
> extracted\_content AS extracted\_content  
> FROM  
> my\_model

dbt\_project.yml :

> name: ‘my\_project\_dbt’  
> version: ‘1.0.0’  
> config-version: 2
> 
> profile: ‘my\_project\_dbt’
> 
> model-paths: [“models”]  
> analysis-paths: [“analyses”]  
> test-paths: [“tests”]  
> seed-paths: [“seeds”]  
> macro-paths: [“macros”]  
> snapshot-paths: [“snapshots”]
> 
> clean-targets: # directories to be removed by `dbt clean`
> 
> - “target”
> - “dbt\_packages”
> 
> # Configuring models
> 
> models:  
> my\_model:  
> description: “Transformation of STUDYID data”  
> +materialized: table  
> database: my\_project  
> schema: sas\_test  
> alias: tabletest  
> sql: models/my\_model.sql

profiles.yml :

> my\_project\_dbt:  
> target: dev  
> outputs:  
> dev:  
> type: bigquery  
> method: oauth  
> project: my\_project  
> dataset: sas\_test

I have two problem when I run dbt run :

- the view that is created has the same name as the sql file but I want another name, for exemple “tabletest”
- I want a table, not a view.

When I run “dbt run” I got this :

> 12:03:03 Running with dbt=1.6.3  
> 12:03:03 Registered adapter: bigquery=1.6.5  
> 12:03:03 [WARNING]: Configuration paths exist in your dbt\_project.yml file which do not apply to any resources.  
> There are 1 unused configuration paths:
> 
> - models.my\_model  
> 12:03:03 Found 1 model, 0 sources, 0 exposures, 0 metrics, 390 macros, 0 groups, 0 semantic models  
> 12:03:03  
> 12:03:05 Concurrency: 1 threads (target=‘dev’)  
> 12:03:05  
> 12:03:05 1 of 1 START sql view model sas\_test.my\_sql\_file … [RUN]  
> 12:03:06 1 of 1 OK created sql view model sas\_test.my\_sql\_file … [CREATE VIEW (0 processed) in 0.93s]  
> 12:03:06  
> 12:03:06 Finished running 1 view model in 0 hours 0 minutes and 2.75 seconds (2.75s).  
> 12:03:06  
> 12:03:06 Completed successfully  
> 12:03:06  
> 12:03:06 Done. PASS=1 WARN=0 ERROR=0 SKIP=0 TOTAL=1

We can see that my model is not used :

> There are 1 unused configuration paths:
> 
> - models.my\_model

here my dbt --version

> Core:
> 
> - installed: 1.6.3
> - latest: 1.6.3 - Up to date!
> 
> Plugins:
> 
> - bigquery: 1.6.5 - Up to date!

Thank you for your help !

---

<div class="post-metadata">

**Author:** ![brunoszdl](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/brunoszdl/32/4113_2.png) [@brunoszdl](https://discourse.getdbt.com/u/brunoszdl)\
**Post date:** [September 29, 2023, 12:55pm UTC](https://discourse.getdbt.com/t/dbt-run-create-bigquery-view-and-not-table/10135/2 "2023-09-29T12:55:42Z")

</div>

It seems your model is called `my_sql_file`, but in the `dbt_project.yml` you are calling it `my_model`.

You should use the file name in the `dbt_project.yml`, so `my_sql_file` instead of `my_model`
