Skip to content

Commit

Permalink
Merge pull request #39 from fishtown-analytics/fix-readme
Browse files Browse the repository at this point in the history
Give codeblocks more space to fix rendering
  • Loading branch information
Claire Carroll authored May 20, 2021
2 parents a195db3 + 5a2e0a0 commit 0adeb2e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.3-stretch
- image: circleci/python:3.6.13-stretch
- image: circleci/postgres:9.6.5-alpine-ram

steps:
Expand Down
39 changes: 26 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,27 @@ source data is in.
column names to your source definition.

### Usage:
1. Use the macro (in dbt Develop, in a scratch file, or in a run operation) like
so:
1. Copy the macro into a statement tab in the dbt Cloud IDE, or into an analysis file, and compile your code

```
{{ codegen.generate_source('raw_jaffle_shop') }}
```

Alternatively, call the macro as an [operation](https://docs.getdbt.com/docs/using-operations):

```
$ dbt run-operation generate_source --args 'schema_name: raw_jaffle_shop'
```

or

```
# for multiple arguments, use the dict syntax
$ dbt run-operation generate_source --args '{"schema_name": "raw_jaffle_shop", "database_name": "raw"}'
$ dbt run-operation generate_source --args '{"schema_name": "jaffle_shop", "database_name": "raw"}'
```

2. The YAML for the source will be logged to the command line

```
version: 2
Expand All @@ -51,6 +57,7 @@ sources:
- name: orders
- name: payments
```

3. Paste the output in to a schema `.yml` file, and refactor as required.

## generate_base_model ([source](macros/generate_base_model.sql))
Expand All @@ -64,21 +71,23 @@ model.

### Usage:
1. Create a source for the table you wish to create a base model on top of.
2. Use the macro (in dbt Develop, or in a scratch file), and compile your code
2. Copy the macro into a statement tab in the dbt Cloud IDE, or into an analysis file, and compile your code

```
{{
codegen.generate_base_model(
{{ codegen.generate_base_model(
source_name='raw_jaffle_shop',
table_name='customers'
)
}}
) }}
```

Alternatively, call the macro as an [operation](https://docs.getdbt.com/docs/using-operations):

```
$ dbt run-operation generate_base_model --args '{"source_name": "raw_jaffle_shop", "table_name": "customers"}'
```

3. The SQL for a base model will be logged to the command line

```
with source as (
Expand All @@ -101,6 +110,7 @@ renamed as (
select * from renamed
```

4. Paste the output in to a model, and refactor as required.

## generate_model_yaml ([source](macros/generate_model_yaml.sql))
Expand All @@ -112,20 +122,22 @@ schema.yml file.

### Usage:
1. Create a model.
2. Use the macro (in dbt Develop, or in a scratch file), and compile your code
2. Copy the macro into a statement tab in the dbt Cloud IDE, or into an analysis file, and compile your code

```
{{
codegen.generate_model_yaml(
{{ codegen.generate_model_yaml(
model_name='customers'
)
}}
) }}
```

Alternatively, call the macro as an [operation](https://docs.getdbt.com/docs/using-operations):

```
$ dbt run-operation generate_model_yaml --args '{"model_name": "customers"}'
```

3. The YAML for a base model will be logged to the command line

```
version: 2
Expand All @@ -137,4 +149,5 @@ models:
- name: customer_name
description: ""
```

4. Paste the output in to a schema.yml file, and refactor as required.

0 comments on commit 0adeb2e

Please sign in to comment.