Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
cocopo-codes committed Mar 4, 2021
1 parent 86d4136 commit 59ded6f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,30 @@ This dbt model is based on the premise that three kids are playing a video game

Overall it has some simple dbt models along with related tests. Its purpose is to provide users with some quick examples of dbt schema and data tests.

In order to create this dbt model, you will want to install [dbt](https://docs.getdbt.com/docs/introduction) before you clone this repository
**Note:** This project uses BigQuery to contain the dbt project's data, so the instructions are specific to BigQuery database configuration.

This project requires the setup of a PostgreSQL BigQuery server where you will be able to run these seeds, models and tests. I used [this guide](https://cloud.google.com/sql/docs/postgres/create-instance#create-2nd-gen) to set up my PostgreSQL container on BigQuery with dbt.
### Before Running the Project (Prerequisites)
In order to create this dbt model, you will want to **install [dbt]**(https://docs.getdbt.com/docs/introduction) before you clone this repository

The project has custom configuration instructions for the dbt profiles.yml file, which is covered in [dbt documentation](https://docs.getdbt.com/reference/profiles.yml/) if the tutorial isn't enough.
This project requires the **setup of a PostgreSQL BigQuery server** where you will be able to run these seeds, models and tests. I used [this guide](https://cloud.google.com/sql/docs/postgres/create-instance#create-2nd-gen) to set up my PostgreSQL container on BigQuery with dbt.

The project has **custom configuration instructions for the dbt profiles.yml file**, which is covered in [dbt documentation](https://docs.getdbt.com/reference/profiles.yml/) if the tutorial isn't enough.

### How to Run the Project
#### Step 1.
Create a Big Query project, and subsequently a PostgreSQL Resource inside the project.
Create a Big Query project (Referenced above), and subsequently a PostgreSQL Resource inside the project.

To run this project, you'll need the following from your Big Query SQL instance:
- The instance connection name (usually something like "jenny-cassette-8675309"), called "project" in profiles.yml
- The Service Account JSON key for your specific project (a downloadable JSON key you'll reference), called a "keyfile" in profiles.yml
- The dataset name (usually "postgres" automatically when you create a PostgreSQL instance in Big Query, you should not have to change this)
- The dataset (schema) name

#### Step 2.
Clone this repo to your machine.

Now, you'll bring your Big Query values into profiles.yml and sources.yml.
Bring your Big Query values into profiles.yml (local under the hidden .dbt/ folder) and the project's [sources.yml](https://github.com/corissawex/dbtTestExamples/blob/86d41367884fa8d27383f099e0132b7f730b9ba4/models/1-source/sources.yml#L6).

Sources.yml is easy; you just need to enter the database name (instance connection name).
Sources.yml is quick; follow the comments and enter the database name (instance connection name) and the schema (dataset) name.

Profiles.yml is a little more complex so you should just copy and paste the below profile, then enter the right values for your Big Query keyfile and project.

Expand Down Expand Up @@ -70,6 +73,10 @@ Alternatively, you can choose to run just schema or data tests using these comma
dbt test --data

dbt test --schema

Or, run all tests for a specific model:

dbt test --models statistics

### I already know dbt, can I just jump in?
Sure! Just be sure to connect Big Query to this dbt project after you've cloned it, and reconfigure any custom changes.
Expand Down

0 comments on commit 59ded6f

Please sign in to comment.