mirror of
https://github.com/FlipsideCrypto/external-models.git
synced 2026-02-06 10:46:48 +00:00
rm nulls
This commit is contained in:
parent
dc442db717
commit
94aa9aba9d
@ -9,26 +9,28 @@ SELECT
|
||||
'active_users' AS metric,
|
||||
'The reported number of active users as of the block_date' AS description,
|
||||
metric_date AS block_date,
|
||||
metric_value AS active_users,
|
||||
metric_value :: INT AS active_users,
|
||||
_inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(['blockchain', 'metric', 'block_date']) }} AS active_users_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
FROM
|
||||
{{ ref('silver__artemis') }}
|
||||
WHERE
|
||||
metric = 'dau'
|
||||
AND metric_value IS NOT NULL
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP_NTZ)
|
||||
FROM {{ this }}
|
||||
)
|
||||
AND NULLIF(TRIM(metric_value), 'null') IS NOT NULL
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
COALESCE(MAX(_inserted_timestamp), '1970-01-01' :: timestamp_ntz)
|
||||
FROM
|
||||
{{ this }})
|
||||
{% endif %}
|
||||
QUALIFY ROW_NUMBER() OVER (
|
||||
|
||||
qualify ROW_NUMBER() over (
|
||||
PARTITION BY active_users_id
|
||||
ORDER BY
|
||||
_inserted_timestamp DESC
|
||||
) = 1
|
||||
) = 1
|
||||
|
||||
@ -9,27 +9,28 @@ SELECT
|
||||
'tx_count' AS metric,
|
||||
'The reported number of transactions as of the block_date' AS description,
|
||||
metric_date AS block_date,
|
||||
metric_value AS tx_count,
|
||||
metric_value :: INT AS tx_count,
|
||||
_inserted_timestamp,
|
||||
{{ dbt_utils.generate_surrogate_key(['blockchain', 'metric', 'block_date']) }} AS tx_count_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
FROM
|
||||
{{ ref('silver__artemis') }}
|
||||
WHERE
|
||||
metric = 'daily_txns'
|
||||
AND metric_value IS NOT NULL
|
||||
AND NULLIF(TRIM(metric_value), 'null') IS NOT NULL
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT COALESCE(MAX(_inserted_timestamp), '1970-01-01'::TIMESTAMP_NTZ)
|
||||
FROM {{ this }}
|
||||
)
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
COALESCE(MAX(_inserted_timestamp), '1970-01-01' :: timestamp_ntz)
|
||||
FROM
|
||||
{{ this }})
|
||||
{% endif %}
|
||||
|
||||
QUALIFY ROW_NUMBER() OVER (
|
||||
qualify ROW_NUMBER() over (
|
||||
PARTITION BY tx_count_id
|
||||
ORDER BY
|
||||
_inserted_timestamp DESC
|
||||
) = 1
|
||||
) = 1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user