Skip to content

Commit

Permalink
test #5
Browse files Browse the repository at this point in the history
  • Loading branch information
laysabit committed Mar 14, 2024
1 parent fdfd9e3 commit bac100e
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 50 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/diff-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,4 @@ jobs:
- name: Checkout source branch and diff quality
run: |
git checkout ${{ github.ref_name }}
dbt docs generate
# diff-quality --violations=sqlfluff
diff-quality --violations=sqlfluff --compare-branch=origin/master
6 changes: 6 additions & 0 deletions .sqlfluffignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test/
macros/
snapshots/
env/
dbt_packages/
target/
10 changes: 5 additions & 5 deletions models/marts/enriched_history_operations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ with
, batch_run_date
, batch_insert_ts
from {{ ref('stg_history_ledgers') }}
where
where
cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day)
and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% if is_incremental() %}
{% if is_incremental() %}
and cast(batch_run_date as date) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
and date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% endif %}
Expand Down Expand Up @@ -76,7 +76,7 @@ with
where
cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day)
and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% if is_incremental() %}
{% if is_incremental() %}
and cast(batch_run_date as date) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
and date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% endif %}
Expand Down Expand Up @@ -195,7 +195,7 @@ with
, asset_balance_changes
, parameters
, parameters_decoded
, `function`
, function
, address
, soroban_operation_type
, extend_to
Expand All @@ -205,7 +205,7 @@ with
where
cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day)
and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% if is_incremental() %}
{% if is_incremental() %}
and cast(batch_run_date as date) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
and date(closed_at) >= date_sub(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions models/marts/fee_stats_agg.sql
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ with
where
cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day)
and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% if is_incremental() %}
{% if is_incremental() %}
and cast(batch_run_date as date) >= date('{{ dbt_airflow_macros.ds() }}') -- batch run is the min bound of a batch
and date(closed_at) >= date('{{ dbt_airflow_macros.ds() }}')
{% endif %}
Expand All @@ -104,7 +104,7 @@ with
where
cast(batch_run_date as date) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 2 day)
and date(closed_at) < date_add(date('{{ dbt_airflow_macros.ds() }}'), interval 1 day)
{% if is_incremental() %}
{% if is_incremental() %}
and cast(batch_run_date as date) >= date('{{ dbt_airflow_macros.ds() }}') -- batch run is the min bound of a batch
and date(closed_at) >= date('{{ dbt_airflow_macros.ds() }}')
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions models/marts/ledger_current_state/account_signers_current.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ with
, s.batch_run_date
, s.batch_insert_ts
, row_number()
over (
partition by s.account_id, s.signer
order by s.last_modified_ledger desc, s.ledger_entry_change desc
) as row_nr
over (
partition by s.account_id, s.signer
order by s.last_modified_ledger desc, s.ledger_entry_change desc
) as row_nr
from {{ ref('stg_account_signers') }} as s
join {{ ref('stg_history_ledgers') }} as l
on s.last_modified_ledger = l.sequence
Expand Down
14 changes: 7 additions & 7 deletions models/marts/ledger_current_state/accounts_current.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ with
, a.batch_run_date
, a.batch_insert_ts
, row_number()
over (
partition by a.account_id
order by
a.last_modified_ledger desc
, a.ledger_entry_change desc
)
as row_nr
over (
partition by a.account_id
order by
a.last_modified_ledger desc
, a.ledger_entry_change desc
)
as row_nr
from {{ ref('stg_accounts') }} as a
join {{ ref('stg_history_ledgers') }} as l
on a.last_modified_ledger = l.sequence
Expand Down
8 changes: 4 additions & 4 deletions models/marts/ledger_current_state/liquidity_pools_current.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ with
, lp.batch_run_date
, lp.batch_insert_ts
, row_number()
over (
partition by lp.liquidity_pool_id
order by lp.last_modified_ledger desc, lp.ledger_entry_change desc
) as row_nr
over (
partition by lp.liquidity_pool_id
order by lp.last_modified_ledger desc, lp.ledger_entry_change desc
) as row_nr
from {{ ref('stg_liquidity_pools') }} as lp
join {{ ref('stg_history_ledgers') }} as l
on lp.last_modified_ledger = l.sequence
Expand Down
8 changes: 4 additions & 4 deletions models/marts/ledger_current_state/offers_current.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ with
, o.batch_run_date
, o.batch_insert_ts
, row_number()
over (
partition by o.offer_id
order by o.last_modified_ledger desc, o.ledger_entry_change desc
) as row_nr
over (
partition by o.offer_id
order by o.last_modified_ledger desc, o.ledger_entry_change desc
) as row_nr
from {{ ref('stg_offers') }} as o
join {{ ref('stg_history_ledgers') }} as l
on o.last_modified_ledger = l.sequence
Expand Down
8 changes: 4 additions & 4 deletions models/marts/ledger_current_state/trust_lines_current.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ with
, tl.batch_run_date
, tl.batch_insert_ts
, row_number()
over (
partition by tl.account_id, tl.asset_code, tl.asset_issuer, tl.liquidity_pool_id
order by tl.last_modified_ledger desc, tl.ledger_entry_change desc
) as row_nr
over (
partition by tl.account_id, tl.asset_code, tl.asset_issuer, tl.liquidity_pool_id
order by tl.last_modified_ledger desc, tl.ledger_entry_change desc
) as row_nr
from {{ ref('stg_trust_lines') }} as tl
join {{ ref('stg_history_ledgers') }} as l
on tl.last_modified_ledger = l.sequence
Expand Down
8 changes: 4 additions & 4 deletions models/marts/ledger_current_state/ttl_current.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ with
, ttl.batch_run_date
, ttl.batch_insert_ts
, row_number()
over (
partition by ttl.key_hash
order by ttl.last_modified_ledger desc, ledger_entry_change
) as rn
over (
partition by ttl.key_hash
order by ttl.last_modified_ledger desc, ledger_entry_change
) as rn
from {{ ref('stg_ttl') }} as ttl
{% if is_incremental() %}
-- limit the number of partitions fetched incrementally
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_account_signers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'account_signers')}}
from {{ source('crypto_stellar', 'account_signers') }}
)

, account_signers as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_accounts.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'accounts')}}
from {{ source('crypto_stellar', 'accounts') }}
)

, accounts as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_claimable_balances.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'claimable_balances')}}
from {{ source('crypto_stellar', 'claimable_balances') }}
)

, claimable_balance as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_contract_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ with
)

select *
from raw_table
from contract_data
2 changes: 1 addition & 1 deletion models/staging/stg_history_effects.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'history_effects')}}
from {{ source('crypto_stellar', 'history_effects') }}
)

, history_effects as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_history_ledgers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'history_ledgers')}}
from {{ source('crypto_stellar', 'history_ledgers') }}
)

, history_ledgers as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_history_operations.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'history_operations')}}
from {{ source('crypto_stellar', 'history_operations') }}
)

, history_operations as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_history_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'history_trades')}}
from {{ source('crypto_stellar', 'history_trades') }}
)

, history_trades as (
Expand Down
4 changes: 2 additions & 2 deletions models/staging/stg_history_transactions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'history_transactions')}}
from {{ source('crypto_stellar', 'history_transactions') }}
)

, history_transactions as (
Expand Down Expand Up @@ -45,7 +45,7 @@ with
, closed_at
, batch_id
, batch_run_date
, batch_insert_ts
, batch_insert_ts
from raw_table
)

Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_liquidity_pools.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'liquidity_pools')}}
from {{ source('crypto_stellar', 'liquidity_pools') }}
)

, liquidity_pool as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_offers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'offers')}}
from {{ source('crypto_stellar', 'offers') }}
)

, offers as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_trust_lines.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'trust_lines')}}
from {{ source('crypto_stellar', 'trust_lines') }}
)

, trust_lines as (
Expand Down
2 changes: 1 addition & 1 deletion models/staging/stg_ttl.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
with
raw_table as (
select *
from {{ source('crypto_stellar', 'ttl')}}
from {{ source('crypto_stellar', 'ttl') }}
)

, ttl as (
Expand Down

0 comments on commit bac100e

Please sign in to comment.