Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pinakidas committed Jun 14, 2022
1 parent 01c302d commit 9a44380
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,26 @@ This overwrites the default implementation of generate_schema_name from the core
```

#### smart_source
This macro helps use keep a check on the bigquery costs and at the same time validate sql queries end to end
You can use the codegen package to have the script generated and then replace `source` with `smart_source`
This macro helps use keep a check on the bigquery costs and at the same time validate sql queries end to end.
You can use the codegen package to have the script generated and then replace `source` with `smart_source`.
[Link](https://github.com/dbt-labs/dbt-codegen#usage-1) on usage of codegen for generating SQL for a base model

Snippets to generate base mode code for reference

Executing using scratchpad
```
{{ codegen.generate_base_model(
source_name='<source_name>',
table_name='<table_name>'
) }}
```

Execting the macro as an operation
```
dbt run-operation generate_base_model --args '{"source_name": "<source_name>", "table_name": "<table_name>"}'
```

On the generated sql, replace `source` with `smart_source`

```sql
with source as (
Expand Down

0 comments on commit 9a44380

Please sign in to comment.