This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id | region | user_id | price | |
|---|---|---|---|---|
| 1 | US | 1 | 5.00 | |
| 2 | US | 1 | 7.50 | |
| 3 | US | 2 | 12.99 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id | region | user_id | price | returned_at | |
|---|---|---|---|---|---|
| 1 | UK | 3 | 6.50 | 2017-10-14 12:30:00 | |
| 2 | UK | 4 | 3.99 | NULL | |
| 3 | UK | 5 | 8.00 | NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| _dbt_source_table | id | region | user_id | price | returned_at | |
|---|---|---|---|---|---|---|
| analytics.uk_orders | 1 | UK | 3 | 6.50 | 2017-10-14 12:30:00 | |
| analytics.uk_orders | 2 | UK | 4 | 3.99 | NULL | |
| analytics.uk_orders | 3 | UK | 5 | 8.00 | NULL | |
| analytics.us_orders | 1 | US | 1 | 5.00 | NULL | |
| analytics.us_orders | 2 | US | 1 | 7.50 | NULL | |
| analytics.us_orders | 3 | US | 2 | 12.99 | NULL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id | user | state | is_CA | is_PA | is_NY | |
|---|---|---|---|---|---|---|
| 1 | alice | CA | 1 | 0 | 0 | |
| 2 | bob | CA | 1 | 0 | 0 | |
| 3 | cathy | NY | 0 | 0 | 1 | |
| 4 | dave | PA | 0 | 1 | 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- USAGE: | |
| {{ | |
| config( | |
| materialized='insert', | |
| dest_table='dbt_dbanin.table_to_insert_into', | |
| date_field="timestamp", | |
| start_date='2017-07-01' | |
| ) | |
| }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create table public.test as ( | |
| select 1 as id | |
| ); | |
| create view public.test_view as ( | |
| select * from public.test | |
| ); | |
| drop table public.test; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create table public.test as ( | |
| select 1 as id | |
| ); | |
| -- NOTE: This is a late binding view. Note the | |
| -- "WITH NO SCHEMA BINDING" clause at the | |
| -- end of the `create view` statement. | |
| create view public.test_view as ( | |
| select * from public.test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select * from public.test_view; | |
| ERROR: relation "public.test" does not exist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create table public.test as ( | |
| select 2 as id | |
| ); | |
| select * from public.test_view; | |
| --SELECT (it worked!) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| This config will materialize this dbt model as a late-binding view. | |
| Note that dbt models are by-default materialized as views, so it's | |
| not always necessary to specify `materialized='view` here. | |
| */ | |
| {{ config(materialized='view', bind=False) }} | |
| select * from public.test |