Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Shopify: Add DBT Connector #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 83 additions & 6 deletions connectors/source_shopify/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,86 @@
# Airbyte source_shopify dbt Package
# Shopify Airbyte dbt Package

This package contains dbt models for Airbyte source_shopify source.
---

What it includes:
- This package contains dbt models to work with Airbyte Shopify connector.
- The package is compatible with latest version of Airbyte Shopify connector.
- Currently, it is limited to creating transformations compatible with [Fivetran's modeling dbt package](https://github.com/fivetran/dbt_shopify/tree/main).
- In the future, specific models will be applied directly to Airbyte connector output. If you have an idea or want to propose an analytical model for this source, please refer to the contributing guide, which explains how to propose a new transformation model.
- This package was tested with BigQuery, Snowflake, and Postgres data warehouses.

---

## 🎯 Intructions how to use

### Airbyte dbt Package

For now Airbyte dbt packages aren't versioned. You must configure using git and subdirectory. For now there isn't any transformation model directly applied to this package. But you can generate docs and tests with dbt.

Create the following files:

**`dbt_project.yml`**

```yaml
vars:
using_fivetran_model: False
airbyte_database: "airbyte_db_default"
airbyte_schema: "airbyte_dbt_shopify"
```

**`packages.yml`**

```yaml
packages:
- git: "https://github.com/airbytehq/airbyte-dbt-models.git"
subdirectory: "connectors/source_shopify"
```

After you can run `dbt tests` or `dbt docs generate` to have a preview of Airbyte output data.

### Fivetran Zendesk Modeling dbt package

This package transforms Airbyte connector output data, making it compatible with Fivetran's Zendesk dbt package. You can check the analytical models Fivetran creates [here](https://github.com/fivetran/dbt_zendesk/tree/main?tab=readme-ov-file#-what-does-this-dbt-package-do). The link also provides information about how the package works and what is configurable.

Create the require files to use Airbyte and Fivetran dbt packages:

**`packages.yml`**

```yaml
packages:
- git: "https://github.com/airbytehq/airbyte-dbt-models.git"
subdirectory: "connectors/source_shopify"

- package: fivetran/zendesk
version: [">=0.16.0", "<0.17.0"]
```

This is a default variable definition you must configure to have the models created.
At the moment this package doesn't support (schedules, domains, user tags, ticket form history and organization tags) for that reason keep those variables set to `False`.
Variables starting with the prefix `shopify_..._identifier` represent the names of tables generated by the Airbyte connector. If you configured your sync with this prefix, ensure you edit it accordingly.

**`dbt_project.yml`**

```yaml
vars:
# Required by Airbyte dbt model
using_fivetran_model: True
airbyte_database: "airbyte_db_default"
airbyte_schema: "airbyte_dbt_shopify"

# Required by Fivetran dbt model
shopify_database: "airbyte_db_default"
shopify_schema: "airbyte_dbt_shopify"

# Need to work - WIP

```

After run `dbt run`, you can see the models being created.

---

## :package: Package Maintenance

- This package is maintained by the Airbyte Community.
- You can contribute any time please read the Contributing Guidelines or enter the Airbyte Slack Channel `#airbyte-dbt-packages`

* A complete source description
* ERD model for the source
* Diagram documentation for the source
4 changes: 2 additions & 2 deletions connectors/source_shopify/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ config-version: 2

version: 0.1.0

profile: airbyte
profile: integration_tests

model-paths:
- models
Expand All @@ -24,7 +24,7 @@ require-dbt-version:
- <2.0.0

models:
source_shopify:
airbyte_dbt_source_shopify:
materialized: view
staging:
materialized: view
Expand Down
56 changes: 56 additions & 0 deletions connectors/source_shopify/integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: integration_test_shopify

config-version: 2

version: 0.1.0

profile: integration_tests

model-paths:
- models

macro-paths:
- macros

target-path: target

clean-targets:
- target
- dbt_modules
- logs

require-dbt-version:
- ">=1.3.0"
- <2.0.0

models:
airbyte_dbt_source_shopify:
materialized: view
+schema: dbt_source_shopify
staging:
materialized: view
tmp:
materialized: view

vars:
# Required by Airbyte dbt model
using_fivetran_model: True
airbyte_database: "airbyte_db_default"
airbyte_schema: "dbt_source_shopify"

# Required by Fivetran dbt model
shopify_database: "airbyte_db_default"
shopify_schema: "dbt_source_shopify"

shopify_customers_identifier: "customer"
shopify_customer_emails_identifier: "customer_email"
shopify_orders_identifier: "order"
shopify_products_identifier: "product"
shopify_transactions_identifier: "transactions"
shopify_discount_codes_identifier: "discount_codes"
shopify_inventory_levels_identifier: "inventory_levels"





11 changes: 11 additions & 0 deletions connectors/source_shopify/integration_tests/package-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
packages:
- package: fivetran/shopify_source
version: [">=0.12.0", "<0.13.0"]
- package: fivetran/fivetran_utils
version: [">=0.4.0", "<0.5.0"]
- package: dbt-labs/dbt_utils
version: [">=1.0.0", "<2.0.0"]
- package: calogica/dbt_date
version: [">=0.9.0", "<1.0.0"]
- package: dbt-labs/spark_utils
version: [">=0.3.0", "<0.4.0"]
5 changes: 5 additions & 0 deletions connectors/source_shopify/integration_tests/packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
packages:
- local: ../

- package: fivetran/shopify
version: [">=1.3.0", "<2.0.0"]
1 change: 1 addition & 0 deletions connectors/source_shopify/integration_tests/vars
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{airbyte_database: $AB_DB, shopify_database: $AB_DB}
Empty file.
Empty file.