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

stage all metronome data #669

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions data/transform/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ models:
+schema: github_meltano
meltanohub:
+schema: meltanohub
metronome:
+schema: metronome
slack:
+schema: slack
snowplow:
Expand Down
15 changes: 15 additions & 0 deletions data/transform/models/staging/metronome/sources.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions data/transform/models/staging/metronome/stg_metronome__invoice.sql
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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