This info is for contributors who plan to use DBT to contribute to Flipside's data models. A DBT profile is not required to add tags via a seed file (to add tags, follow the instructions above).
crosschain:
target: dev
outputs:
dev:
type: snowflake
account: <ACCOUNT>
role: <ROLE>
user: <USERNAME>
password: <PASSWORD>
region: <REGION>
database: CROSSCHAIN_DEV
warehouse: <WAREHOUSE>
schema: silver
threads: 4
client_session_keep_alive: False
query_tag: <TAG>
To control the creation of UDF or SP macros with dbt run:
- UPDATE_UDFS_AND_SPS
-
Default values are False
-
When True, executes all macros included in the on-run-start hooks within dbt_project.yml on model run as normal
-
When False, none of the on-run-start macros are executed on model run
-
Usage:
dbt run --vars '{"UPDATE_UDFS_AND_SPS":True}' -m ...
-
Use a variable to heal a model incrementally:
- HEAL_MODEL
-
Default is FALSE (Boolean)
-
When FALSE, logic will be negated
-
When TRUE, heal logic will apply
-
Include
heal
in model tags within the config block for inclusion in thedbt_run_heal_models
workflow, e.g.tags = 'heal'
-
Usage:
dbt run --vars '{"HEAL_MODEL":True}' -m ...
-
Use a variable to negate incremental logic:
- Example use case: reload records in a curated complete table without a full-refresh, such as
silver_bridge.complete_bridge_activity
: - HEAL_MODELS
-
Default is an empty array []
-
When item is included in var array [], incremental logic will be skipped for that CTE / code block
-
When item is not included in var array [] or does not match specified item in model, incremental logic will apply
-
Example set up:
{% if is_incremental() and 'axelar' not in var('HEAL_MODELS') %}
-
Usage:
- Single CTE:
dbt run --vars '{"HEAL_MODELS":"axelar"}' -m ...
- Multiple CTEs:
dbt run --vars '{"HEAL_MODELS":["axelar","across","celer_cbridge"]}' -m ...
- Single CTE:
-
Use a variable to extend the incremental lookback period:
- LOOKBACK
-
Default is a string representing the specified time interval e.g. '12 hours', '7 days' etc.
-
Example set up:
SELECT MAX(_inserted_timestamp) - INTERVAL '{{ var("LOOKBACK", "4 hours") }}'
-
Usage:
dbt run --vars '{"LOOKBACK":"36 hours"}' -m ...
-
There are 3 ways to add tags to our data!
You can use a Flipside query to create a tag set that will run on a reoccurring basis. This is a very powerful and scalable way to create a dynamic tag set that can update regularly.
To submit a Flipside query for tagging:
- Submit a Github issue on this repo.
- Title the issue: "Tags: " and the name of the tag(s) you wish to include in our data model.
- In the comment section, paste the query SQL that can be run to isolate the addresses you want to tag (also include a link to the query in the Flipside app).
- Assign the issue to gronders for review.
- Submit!
We will review your query and get back to you if there are any questions or changes.
Your tags query must return these 7 columns:
Column Name | Data type | Description |
---|---|---|
blockchain | string | The blockchain that the address belongs to. |
creator | string | Who created the tag. Use your Flipside username, shown in your Flipside profile URL, for tags you create. |
address | string | The address of the contract or wallet the tag describes. |
tag_name | string | Tag name (sub-category). |
tag_type | string | Tag type (high-level category). |
start_date | timestamp | Date the tag first applies. For tags that are permanent, this might be the date the address had its first behavior that warrants its tag, or the addresses' first transaction (e.g. if the tag identifies a celebrity NFT address). |
end_date | timestamp | Date the tag no longer applies (for tags that are permanent or currently active, end_date can be NULL). |
We recommend you review our docs on Tags before contributing your first tags query.
If you have a static list of addresses that need a tag, a DBT seed file is the best route. This is the most efficient method to tag a list of addresses that will not change and don't rely on a SQL query.
In order to submit a DBT seed file, we will be using a Pull Request (PR). Please see the docs on how to create a pull request! Once you are familiar with PR's, to add your tags:
- Create your DBT seed file. (A DBT seed file is a csv file with the same column names as our table that can be uploaded via DBT.)
- DBT seed file needs to have the naming convention:
silver__<name of seed file>.csv
. Please try to make the name unique, we don't want mulitple files with the same naming convention. - Place the seed file within the
data/
folder of the repo. - Create your PR to add your seed file to our data model.
- Assign the PR to gronders for review.
We will review your seed file and get back to you if there are any questions or changes.
Your seed file must contain these 7 columns:
Column Name | Data type | Description |
---|---|---|
blockchain | string | The blockchain that the address belongs to. |
creator | string | Who created the tag. Use your Flipside username, shown in your Flipside profile URL, for tags you create. |
address | string | The address of the contract or wallet the tag describes. |
tag_name | string | Tag name (sub-category). |
tag_type | string | Tag type (high-level category). |
start_date | timestamp | Date the tag first applies. For tags that are permanent, this might be the date the address had its first behavior that warrants its tag, or the addresses' first transaction (e.g. if the tag identifies a celebrity NFT address). |
end_date | timestamp | Date the tag no longer applies (for tags that are permanent or currently active, end_date can be NULL). |
We recommend you review our docs on Tags before contributing your first tags seed file.
Flipside has a very active community and extraordinarily helpful employees. Reach out to the community, or to @gto, in Discord and someone will help you set up your tags.
When submitting, please include 3 itmes:
- Brief description of your tag (what are you trying to tag)?
- What is the cadence of refresh this needs?
- SQL query. Reminder, your SQL MUST include:
Column Name | Description |
---|---|
blockchain | The blockchain that the address belongs to. |
creator | Who created the tag. Use your Flipside username, shown in your Flipside profile URL, for tags you create. |
address | The address of the contract or wallet the tag describes. |
tag_name | Tag name (sub-category). |
tag_type | Tag type (high-level category). |
start_date | Date the tag first applies. For tags that are permanent, this might be the date the address had its first behavior that warrants its tag, or the addresses' first transaction (e.g. if the tag identifies a celebrity NFT address). |
end_date | Date the tag no longer applies (for tags that are permanent or currently active, end_date can be NULL). |
- Learn more about dbt in the docs
- Check out Discourse for commonly asked questions and answers
- Join the chat on Slack for live discussions and support
- Find dbt events near you
- Check out the blog for the latest news on dbt's development and best practices