mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 11:26:52 +00:00
macros and bronze
This commit is contained in:
parent
2b8183f234
commit
e3f8483041
@ -24,6 +24,9 @@ clean-targets: # directories to be removed by `dbt clean`
|
||||
- "dbt_modules"
|
||||
- "dbt_packages"
|
||||
|
||||
on-run-start:
|
||||
- "{{create_sps()}}"
|
||||
|
||||
# Configuring models
|
||||
# Full documentation: https://docs.getdbt.com/docs/configuring-models
|
||||
|
||||
|
||||
6
macros/create_sps.sql
Normal file
6
macros/create_sps.sql
Normal file
@ -0,0 +1,6 @@
|
||||
{% macro create_sps() %}
|
||||
{% if target.database == 'NEAR' %}
|
||||
CREATE schema IF NOT EXISTS _internal;
|
||||
{{ sp_create_prod_clone('_internal') }};
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
17
macros/custom_naming_macros.sql
Normal file
17
macros/custom_naming_macros.sql
Normal file
@ -0,0 +1,17 @@
|
||||
{% macro generate_schema_name(
|
||||
custom_schema_name = none,
|
||||
node = none
|
||||
) -%}
|
||||
{% set node_name = node.name %}
|
||||
{% set split_name = node_name.split('__') %}
|
||||
{{ split_name [0] | trim }}
|
||||
{%- endmacro %}
|
||||
|
||||
{% macro generate_alias_name(
|
||||
custom_alias_name = none,
|
||||
node = none
|
||||
) -%}
|
||||
{% set node_name = node.name %}
|
||||
{% set split_name = node_name.split('__') %}
|
||||
{{ split_name [1] | trim }}
|
||||
{%- endmacro %}
|
||||
20
models/bronze/bronze__blocks.sql
Normal file
20
models/bronze/bronze__blocks.sql
Normal file
@ -0,0 +1,20 @@
|
||||
{{ config (
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
record_id,
|
||||
offset_id,
|
||||
block_id,
|
||||
block_timestamp,
|
||||
network,
|
||||
chain_id,
|
||||
tx_count,
|
||||
header,
|
||||
ingested_at AS _ingested_at,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ source(
|
||||
"chainwalkers",
|
||||
"near_blocks"
|
||||
) }}
|
||||
21
models/bronze/bronze__transactions.sql
Normal file
21
models/bronze/bronze__transactions.sql
Normal file
@ -0,0 +1,21 @@
|
||||
{{ config (
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
record_id,
|
||||
tx_id,
|
||||
tx_block_index,
|
||||
offset_id,
|
||||
block_id,
|
||||
block_timestamp,
|
||||
network,
|
||||
chain_id,
|
||||
tx,
|
||||
ingested_at AS _ingested_at,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ source(
|
||||
"chainwalkers",
|
||||
"near_blocks"
|
||||
) }}
|
||||
Loading…
Reference in New Issue
Block a user