Skip to content

Commit

Permalink
stage all metronome data
Browse files Browse the repository at this point in the history
  • Loading branch information
pnadolny13 committed Jul 20, 2023
1 parent 02c5443 commit 1c686ec
Show file tree
Hide file tree
Showing 9 changed files with 196 additions and 0 deletions.
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
14 changes: 14 additions & 0 deletions data/transform/models/staging/metronome/sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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
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,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

0 comments on commit 1c686ec

Please sign in to comment.