Skip to content

Commit

Permalink
fix qs code and remove snippet (#5129)
Browse files Browse the repository at this point in the history
this pr reverts changes from pr #4980.

the db varies from warehouse to warehouse and a snippet isn't
appropriate for this. re-adding the code along with the correct
database/dataset info.

also raised by user ticket and
[discourse](https://discourse.getdbt.com/t/new-user-trying-dbt-building-customres-model-and-getting-error-the-project-raw-has-not-enabled-bigquery/12497)
  • Loading branch information
mirnawong1 authored Mar 22, 2024
2 parents f0a51c6 + 4e4b664 commit 7c7c99a
Show file tree
Hide file tree
Showing 7 changed files with 420 additions and 85 deletions.
74 changes: 72 additions & 2 deletions website/docs/guides/bigquery-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,79 @@ Now that you have a repository configured, you can initialize your project and s

## Build your first model

import BuildFirstModel from '/snippets/quickstarts/_build-your-first-model.md';
You have two options for working with files in the dbt Cloud IDE:

<BuildFirstModel/>
- Create a new branch (recommended) &mdash; Create a new branch to edit and commit your changes. Navigate to **Version Control** on the left sidebar and click **Create branch**.
- Edit in the protected primary branch &mdash; If you prefer to edit, format, or lint files and execute dbt commands directly in your primary git branch. The dbt Cloud IDE prevents commits to the protected branch, so you will be prompted to commit your changes to a new branch.

Name the new branch `add-customers-model`.

1. Click the **...** next to the `models` directory, then select **Create file**.
2. Name the file `customers.sql`, then click **Create**.
3. Copy the following query into the file and click **Save**.


```sql
with customers as (
select
id as customer_id,
first_name,
last_name
from `dbt-tutorial`.jaffle_shop.customers
),
orders as (
select
id as order_id,
user_id as customer_id,
order_date,
status
from `dbt-tutorial`.jaffle_shop.orders
),
customer_orders as (
select
customer_id,
min(order_date) as first_order_date,
max(order_date) as most_recent_order_date,
count(order_id) as number_of_orders
from orders
group by 1
),
final as (
select
customers.customer_id,
customers.first_name,
customers.last_name,
customer_orders.first_order_date,
customer_orders.most_recent_order_date,
coalesce(customer_orders.number_of_orders, 0) as number_of_orders
from customers
left join customer_orders using (customer_id)
)
select * from final
```

4. Enter `dbt run` in the command prompt at the bottom of the screen. You should get a successful run and see the three models.

Later, you can connect your business intelligence (BI) tools to these views and tables so they only read cleaned up data rather than raw data in your BI tool.

#### FAQs

Expand Down
73 changes: 71 additions & 2 deletions website/docs/guides/databricks-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,78 @@ Now that you have a repository configured, you can initialize your project and s

## Build your first model

import BuildFirstModel from '/snippets/quickstarts/_build-your-first-model.md';
You have two options for working with files in the dbt Cloud IDE:

<BuildFirstModel/>
- Create a new branch (recommended) &mdash; Create a new branch to edit and commit your changes. Navigate to **Version Control** on the left sidebar and click **Create branch**.
- Edit in the protected primary branch &mdash; If you prefer to edit, format, or lint files and execute dbt commands directly in your primary git branch. The dbt Cloud IDE prevents commits to the protected branch, so you will be prompted to commit your changes to a new branch.

Name the new branch `add-customers-model`.

1. Click the **...** next to the `models` directory, then select **Create file**.
2. Name the file `customers.sql`, then click **Create**.
3. Copy the following query into the file and click **Save**.

```sql
with customers as (
select
id as customer_id,
first_name,
last_name
from jaffle_shop_customers
),
orders as (
select
id as order_id,
user_id as customer_id,
order_date,
status
from jaffle_shop_orders
),
customer_orders as (
select
customer_id,
min(order_date) as first_order_date,
max(order_date) as most_recent_order_date,
count(order_id) as number_of_orders
from orders
group by 1
),
final as (
select
customers.customer_id,
customers.first_name,
customers.last_name,
customer_orders.first_order_date,
customer_orders.most_recent_order_date,
coalesce(customer_orders.number_of_orders, 0) as number_of_orders
from customers
left join customer_orders using (customer_id)
)
select * from final
```

4. Enter `dbt run` in the command prompt at the bottom of the screen. You should get a successful run and see the three models.

Later, you can connect your business intelligence (BI) tools to these views and tables so they only read cleaned up data rather than raw data in your BI tool.

#### FAQs

Expand Down
72 changes: 70 additions & 2 deletions website/docs/guides/microsoft-fabric-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,77 @@ Now that you have a repository configured, you can initialize your project and s

## Build your first model

import BuildFirstModel from '/snippets/quickstarts/_build-your-first-model.md';
You have two options for working with files in the dbt Cloud IDE:

<BuildFirstModel/>
- Create a new branch (recommended) &mdash; Create a new branch to edit and commit your changes. Navigate to **Version Control** on the left sidebar and click **Create branch**.
- Edit in the protected primary branch &mdash; If you prefer to edit, format, or lint files and execute dbt commands directly in your primary git branch. The dbt Cloud IDE prevents commits to the protected branch, so you will be prompted to commit your changes to a new branch.

Name the new branch `add-customers-model`.

1. Click the **...** next to the `models` directory, then select **Create file**.
2. Name the file `customers.sql`, then click **Create**.
3. Copy the following query into the file and click **Save**.

<File name='customers.sql'>

```sql
with customers as (
select
ID as customer_id,
FIRST_NAME as first_name,
LAST_NAME as last_name
from dbo.customers
),
orders as (
select
ID as order_id,
USER_ID as customer_id,
ORDER_DATE as order_date,
STATUS as status
from dbo.orders
),
customer_orders as (
select
customer_id,
min(order_date) as first_order_date,
max(order_date) as most_recent_order_date,
count(order_id) as number_of_orders
from orders
group by customer_id
),
final as (
select
customers.customer_id,
customers.first_name,
customers.last_name,
customer_orders.first_order_date,
customer_orders.most_recent_order_date,
coalesce(customer_orders.number_of_orders, 0) as number_of_orders
from customers
left join customer_orders on customers.customer_id = customer_orders.customer_id
)
select * from final
```
</File>

4. Enter `dbt run` in the command prompt at the bottom of the screen. You should get a successful run and see the three models.

Later, you can connect your business intelligence (BI) tools to these views and tables so they only read cleaned up data rather than raw data in your BI tool.

#### FAQs

Expand Down
73 changes: 71 additions & 2 deletions website/docs/guides/redshift-qs.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,78 @@ Now that you have a repository configured, you can initialize your project and s

## Build your first model

import BuildFirstModel from '/snippets/quickstarts/_build-your-first-model.md';
You have two options for working with files in the dbt Cloud IDE:

<BuildFirstModel/>
- Create a new branch (recommended) &mdash; Create a new branch to edit and commit your changes. Navigate to **Version Control** on the left sidebar and click **Create branch**.
- Edit in the protected primary branch &mdash; If you prefer to edit, format, or lint files and execute dbt commands directly in your primary git branch. The dbt Cloud IDE prevents commits to the protected branch, so you will be prompted to commit your changes to a new branch.

Name the new branch `add-customers-model`.

1. Click the **...** next to the `models` directory, then select **Create file**.
2. Name the file `customers.sql`, then click **Create**.
3. Copy the following query into the file and click **Save**.

```sql
with customers as (
select
id as customer_id,
first_name,
last_name
from jaffle_shop.customers
),
orders as (
select
id as order_id,
user_id as customer_id,
order_date,
status
from jaffle_shop.orders
),
customer_orders as (
select
customer_id,
min(order_date) as first_order_date,
max(order_date) as most_recent_order_date,
count(order_id) as number_of_orders
from orders
group by 1
),
final as (
select
customers.customer_id,
customers.first_name,
customers.last_name,
customer_orders.first_order_date,
customer_orders.most_recent_order_date,
coalesce(customer_orders.number_of_orders, 0) as number_of_orders
from customers
left join customer_orders using (customer_id)
)
select * from final
```

4. Enter `dbt run` in the command prompt at the bottom of the screen. You should get a successful run and see the three models.

Later, you can connect your business intelligence (BI) tools to these views and tables so they only read cleaned up data rather than raw data in your BI tool.

#### FAQs

Expand Down
Loading

0 comments on commit 7c7c99a

Please sign in to comment.