Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Experimental] Tokens dbt project #4721

Closed
wants to merge 5 commits into from
Closed

[Experimental] Tokens dbt project #4721

wants to merge 5 commits into from

Conversation

aalan3
Copy link
Contributor

@aalan3 aalan3 commented Nov 6, 2023

This is just an example of what the transfers would look like if we were to break it up into its own sub project. It still for example uses the the top level macros folder for all our workarounds.

The benefit of doing this is that the compile times go down by quite a lot and the project is not as heavy. This also creates somewhat of a separation of concern. If we consider going down this path further we can also refactor the shared macros/resources a bit better.

The drawback is that we need to redefine models that we reference such as tokens.erc20 or evms.info as sources which is a bit annoying. We would also need to create a new CI run for each of the sub projects but they would hopefully run faster.

I had to create some sources and copy others. For the base_sources (base tables) I symlinked it, seems like it's possible to symlink files but not folders.

Imagine for example that #4698 and basically the rest of the models under tokens/ where built like this.

Comment on lines +13 to +16
- name: minute
- name: blockchain
- name: contract_address
- name: decimals
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct columns are: [blockchain, contract_address, decimals, symbol]

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be very careful of the dependency direction here.
To prevent any circular dependencies I believe we should only have raw sources in a sub-project.

raw -->-- tokens (subproject) -->-- spellbook (main project)

We can't have a structure where we have both:

tokens -->-- spellbook
tokens --<-- spellbook

For this sub project this probably means:

  • moving tokens.erc20 into the tokens subproject
  • moving evms.info to a shared macro??? (so it can be re-used across projects..)

note: we probably need a better name for the highest level "main" dbt-project (spellbook (main project) here)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point. I think at first we can't really avoid this (imagine for dex/nft trades) for example if someone wants to build labels on top of balances or transfers it would end back up in the parent repo. Eventually though we could enforce this.

This presents another challenge of how to actually map everything and enforce it.

@@ -0,0 +1 @@
../../../../../models/base_sources/ethereum_base_sources.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when thinking about more sub-projects in the future we can put all the shared base sources in it's separate model folder and add it to the model-paths: in every dbt_project.yml file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was thinking the same, we will basically have shared models and shared macros across projects.

@jeff-dude
Copy link
Member

closing this, but it'll be around for alex to reference as needed

@jeff-dude jeff-dude closed this Nov 15, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants