diff --git a/data/transform/dbt_project.yml b/data/transform/dbt_project.yml index aafe491f..0f19044b 100644 --- a/data/transform/dbt_project.yml +++ b/data/transform/dbt_project.yml @@ -56,6 +56,8 @@ models: +schema: github_meltano meltanohub: +schema: meltanohub + metronome: + +schema: metronome slack: +schema: slack snowplow: diff --git a/data/transform/models/staging/metronome/sources.yml b/data/transform/models/staging/metronome/sources.yml new file mode 100644 index 00000000..5115acf6 --- /dev/null +++ b/data/transform/models/staging/metronome/sources.yml @@ -0,0 +1,15 @@ +config-version: 2 +version: 2 +sources: + - name: metronome + database: '{{ env_var("DBT_SNOWFLAKE_DATABASE_RAW") }}' + schema: '{{ env_var("DBT_SNOWFLAKE_SOURCE_SCHEMA_PREFIX", "") }}METRONOME_INTEGRATION' + tables: + - name: credit_grant_deduction + - name: credit_grant + - name: credit_type + - name: customer + - name: invoice + - name: line_item + - name: sub_line_item + - name: plan_charge diff --git a/data/transform/models/staging/metronome/stg_metronome__credit_grant.sql b/data/transform/models/staging/metronome/stg_metronome__credit_grant.sql new file mode 100644 index 00000000..8e7b76e9 --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__credit_grant.sql @@ -0,0 +1,32 @@ +with source as ( + + select * from {{ source('metronome', 'credit_grant') }} + WHERE environment_type = 'PRODUCTION' + +), + +renamed as ( + + select + id, + customer_id, + name, + invoice_id, + priority, + reason, + amount_granted, + amount_granted_credit_type_id, + amount_paid, + amount_paid_credit_type_id, + product_ids, + created_at, + updated_at, + effective_at, + expires_at, + voided_at + + from source + +) + +select * from renamed diff --git a/data/transform/models/staging/metronome/stg_metronome__credit_grant_deduction.sql b/data/transform/models/staging/metronome/stg_metronome__credit_grant_deduction.sql new file mode 100644 index 00000000..d273a2db --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__credit_grant_deduction.sql @@ -0,0 +1,22 @@ +with source as ( + + select * from {{ source('metronome', 'credit_grant_deduction') }} + +), + +renamed as ( + + select + id, + credit_grant_id, + amount, + memo, + invoice_id, + effective_at, + updated_at + + from source + +) + +select * from renamed diff --git a/data/transform/models/staging/metronome/stg_metronome__credit_type.sql b/data/transform/models/staging/metronome/stg_metronome__credit_type.sql new file mode 100644 index 00000000..6754894e --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__credit_type.sql @@ -0,0 +1,21 @@ +with source as ( + + select * from {{ source('metronome', 'credit_type') }} + WHERE environment_type = 'PRODUCTION' + +), + +renamed as ( + + select + id, + name, + is_currency, + updated_at, + _metronome_metadata_id + + from source + +) + +select * from renamed diff --git a/data/transform/models/staging/metronome/stg_metronome__customer.sql b/data/transform/models/staging/metronome/stg_metronome__customer.sql new file mode 100644 index 00000000..b7c0f241 --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__customer.sql @@ -0,0 +1,25 @@ +with source as ( + + select * from {{ source('metronome', 'customer') }} + WHERE environment_type = 'PRODUCTION' + +), + +renamed as ( + + select + id, + name, + ingest_aliases, + salesforce_account_id, + billing_provider_type, + billing_provider_customer_id, + created_at, + updated_at, + archived_at + + from source + +) + +select * from renamed diff --git a/data/transform/models/staging/metronome/stg_metronome__invoice.sql b/data/transform/models/staging/metronome/stg_metronome__invoice.sql new file mode 100644 index 00000000..ff5dcf17 --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__invoice.sql @@ -0,0 +1,29 @@ +with source as ( + + select * from {{ source('metronome', 'invoice') }} + WHERE environment_type = 'PRODUCTION' + +), + +renamed as ( + + select + id, + status, + total, + credit_type_id, + credit_type_name, + customer_id, + plan_id, + plan_name, + start_timestamp, + end_timestamp, + billing_provider_invoice_id, + billing_provider_invoice_created_at, + updated_at + + from source + +) + +select * from renamed diff --git a/data/transform/models/staging/metronome/stg_metronome__line_item.sql b/data/transform/models/staging/metronome/stg_metronome__line_item.sql new file mode 100644 index 00000000..ed1e0517 --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__line_item.sql @@ -0,0 +1,26 @@ +with source as ( + + select * from {{ source('metronome', 'line_item') }} + +), + +renamed as ( + + select + id, + invoice_id, + credit_type_id, + credit_type_name, + name, + quantity, + total, + product_id, + group_key, + group_value, + updated_at + + from source + +) + +select * from renamed diff --git a/data/transform/models/staging/metronome/stg_metronome__plan_charge.sql b/data/transform/models/staging/metronome/stg_metronome__plan_charge.sql new file mode 100644 index 00000000..e2fb7789 --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__plan_charge.sql @@ -0,0 +1,31 @@ +with source as ( + + select * from {{ source('metronome', 'plan_charge') }} + WHERE environment_type = 'PRODUCTION' + +), + +renamed as ( + + select + id, + charge_id, + charge_name, + plan_id, + product_id, + product_name, + billable_metric_id, + billable_metric_name, + start_period, + credit_type_id, + credit_type_name, + charge_type, + quantity, + prices, + updated_at + + from source + +) + +select * from renamed \ No newline at end of file diff --git a/data/transform/models/staging/metronome/stg_metronome__sub_line_item.sql b/data/transform/models/staging/metronome/stg_metronome__sub_line_item.sql new file mode 100644 index 00000000..79d324c6 --- /dev/null +++ b/data/transform/models/staging/metronome/stg_metronome__sub_line_item.sql @@ -0,0 +1,25 @@ +with source as ( + + select * from {{ source('metronome', 'sub_line_item') }} + +), + +renamed as ( + + select + id, + line_item_id, + name, + quantity, + subtotal, + charge_id, + billable_metric_id, + billable_metric_name, + tiers, + updated_at + + from source + +) + +select * from renamed