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

Update Event Models for GMX v2 #7511

Conversation

AIDataMaster
Copy link
Contributor

Thank you for contributing to Spellbook 🪄

Please open the PR in draft and mark as ready when you want to request a review.

Description:

This PR modifies the *_withdrawal_created dbt models to include three new columns:

  • withdrawal_type
  • long_token_swap_path
  • short_token_swap_path

Additionally, we changed the materialization of gmx_v2_arbitrum_erc20 and gmx_v2_avalanche_c_erc20 from views to tables.


quick links for more information:

@github-actions github-actions bot marked this pull request as draft January 21, 2025 18:19
@github-actions github-actions bot added WIP work in progress dbt: hourly covers the hourly dbt subproject labels Jan 21, 2025
@AIDataMaster AIDataMaster marked this pull request as ready for review January 21, 2025 18:34
@github-actions github-actions bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Jan 21, 2025
@jeff-dude
Copy link
Member

thank you for initiating the PR. let's talk http_get() usage again, since it's being revisited here to materialize into a table due to querying the view outputting errors occasionally.

we don't use this function much in spellbook at this time. mostly due to the exact scenario you are running into, and it can lead to prod failures on our cluster the same as it would on a view query execution. if it's an isolated dbt lineage of models, it's usually fine, as next run can resolve itself and it doesn't block other models. ideally though, we would still keep that function out of spellbook if possible.

what do you think of this approach? in practice, it would be:

  • materialized view built on the dune app, using the GMX team account as the owner of it. logic for http_get call would live in that mat view. you can refresh on the schedule which makes sense for you
  • create a spell view, which reads from mat view on the GMX team account

@jeff-dude jeff-dude self-assigned this Jan 21, 2025
@jeff-dude jeff-dude added in review Assignee is currently reviewing the PR and removed ready-for-review this PR development is complete, please review labels Jan 21, 2025
@AIDataMaster
Copy link
Contributor Author

"Create a spell view that reads from a materialized view on the GMX team account."

  • What will happen if the materialized view is deleted later?
  • Could you provide an example of how to reference a materialized view?

I don't want to remove these dbt models gmx_v2_arbitrum_erc20 and gmx_v2_avalanche_c_erc20 because other models reference them, so it would be good to create mat. view on Dune App and then reference it inside of mentioned models.

@jeff-dude
Copy link
Member

  • What will happen if the materialized view is deleted later?

the view will fail at query execution time on the app, saying table doesn't exist. it will signal to you and team that you need to rebuild your mat view.

  • Could you provide an example of how to reference a materialized view?

syntax: {{ source("dune", "result_blockchains", database="dune") }} but replace with your GMX team name / mat view name

source file:

version: 2
sources:
- name: dune
tables:
- name: result_blockchains

should be all you need

@AIDataMaster
Copy link
Contributor Author

  • What will happen if the materialized view is deleted later?

the view will fail at query execution time on the app, saying table doesn't exist. it will signal to you and team that you need to rebuild your mat view.

  • Could you provide an example of how to reference a materialized view?

syntax: {{ source("dune", "result_blockchains", database="dune") }} but replace with your GMX team name / mat view name

source file:

version: 2
sources:
- name: dune
tables:
- name: result_blockchains

should be all you need

Thank you for your help. I will do it this way and tag you when it's ready for review.

@AIDataMaster
Copy link
Contributor Author

@jeff-dude could you help me, please? where should I place "dune" and where to locate team username "gmx-io"?

@AIDataMaster
Copy link
Contributor Author

I have to compile this name dune."gmx-io".result_gmx_v_2_erc_20_from_api

Copy link
Member

@jeff-dude jeff-dude left a comment

Choose a reason for hiding this comment

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

looks like my commit worked. not sure if it was single quotes or what, but this should be proper formatting for mat views 🙏

our dbt source macro compiles to include double quotes around source database/schema/table by default, which i think helps here especially with the gmx-io team name having a dash in there

@jeff-dude jeff-dude added ready-for-merging and removed in review Assignee is currently reviewing the PR labels Jan 22, 2025
@AIDataMaster
Copy link
Contributor Author

looks like my commit worked. not sure if it was single quotes or what, but this should be proper formatting for mat views 🙏

our dbt source macro compiles to include double quotes around source database/schema/table by default, which i think helps here especially with the gmx-io team name having a dash in there

Thank you for your help. I have reviewed your commit. You can merge it if all is fine for you too.

@jeff-dude jeff-dude merged commit b3dccca into duneanalytics:main Jan 23, 2025
3 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dbt: hourly covers the hourly dbt subproject ready-for-merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants