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

dex sector subproject creation #6161

Merged
merged 69 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
f68d3fd
intitiate project
jeff-dude Jun 5, 2024
19de614
Merge branch 'main' into dex-subproject
jeff-dude Jun 6, 2024
e9c269e
initial file movement
jeff-dude Jun 6, 2024
87a69f1
moving around more files
jeff-dude Jun 6, 2024
b621b16
Merge branch 'main' into dex-subproject
jeff-dude Jun 12, 2024
60ec297
move dex aggregator lineage
jeff-dude Jun 12, 2024
5ed276a
fix compile errors
jeff-dude Jun 12, 2024
19f75b0
move dex pools
jeff-dude Jun 12, 2024
fcf9d88
move seeds, tests, fix compile errors
jeff-dude Jun 12, 2024
76a05e2
move generic tests
jeff-dude Jun 12, 2024
8090ff6
move project views, fix compile errors
jeff-dude Jun 12, 2024
f4e49cc
Merge branch 'main' into dex-subproject
jeff-dude Jun 12, 2024
4c641bd
Merge branch 'main' into dex-subproject
jeff-dude Jun 13, 2024
9c4dac5
move more pools
jeff-dude Jun 13, 2024
a86977b
initiate dex sources file, update first ref to source
jeff-dude Jun 13, 2024
469e450
cleanup subproject sources
jeff-dude Jun 13, 2024
9a4b5c7
update dex aggregator to source
jeff-dude Jun 13, 2024
34f0973
dex trades ref to source
jeff-dude Jun 13, 2024
932bb07
cow protocol ref to source
jeff-dude Jun 13, 2024
449717e
cow gnosis ref to source
jeff-dude Jun 13, 2024
a582f69
cleanup old uniswap models
jeff-dude Jun 13, 2024
87c4e92
balancer refs to sources
jeff-dude Jun 13, 2024
8fdeee0
fix compile errors, more refs to sources
jeff-dude Jun 13, 2024
a04eb59
cleanup project file
jeff-dude Jun 13, 2024
145438d
cleanup old dex models
jeff-dude Jun 13, 2024
2775479
move more dependencies for balancer
jeff-dude Jun 13, 2024
2cadc79
intitiate project
jeff-dude Jun 5, 2024
8c5287f
initial file movement
jeff-dude Jun 6, 2024
89c7113
moving around more files
jeff-dude Jun 6, 2024
4831bdd
move dex aggregator lineage
jeff-dude Jun 12, 2024
f32df2e
fix compile errors
jeff-dude Jun 12, 2024
3229457
move dex pools
jeff-dude Jun 12, 2024
463c81c
move seeds, tests, fix compile errors
jeff-dude Jun 12, 2024
2948a9b
move generic tests
jeff-dude Jun 12, 2024
6f578f6
move project views, fix compile errors
jeff-dude Jun 12, 2024
65ef1e6
move more pools
jeff-dude Jun 13, 2024
8192604
initiate dex sources file, update first ref to source
jeff-dude Jun 13, 2024
8e6c6c0
cleanup subproject sources
jeff-dude Jun 13, 2024
faeb980
update dex aggregator to source
jeff-dude Jun 13, 2024
2fd45a6
dex trades ref to source
jeff-dude Jun 13, 2024
16578b9
cow protocol ref to source
jeff-dude Jun 13, 2024
22b9b2b
cow gnosis ref to source
jeff-dude Jun 13, 2024
64fff9f
cleanup old uniswap models
jeff-dude Jun 13, 2024
9a93ed9
balancer refs to sources
jeff-dude Jun 13, 2024
f45bb8b
fix compile errors, more refs to sources
jeff-dude Jun 13, 2024
fd3a9c5
cleanup project file
jeff-dude Jun 13, 2024
48b7068
cleanup old dex models
jeff-dude Jun 13, 2024
13edadc
move more dependencies for balancer
jeff-dude Jun 13, 2024
9f5d565
Fix sources post rebase
aalan3 Jun 14, 2024
26d4f2e
Fix tests for cow
aalan3 Jun 14, 2024
d25ebd3
Fix schema post rebase
aalan3 Jun 14, 2024
b303d5f
Fix dbt_project post rebase
aalan3 Jun 14, 2024
679b988
Switch to source
aalan3 Jun 14, 2024
5c7cc40
Switch to source
aalan3 Jun 14, 2024
3233b00
Add sources
aalan3 Jun 14, 2024
fb9153d
Move test
aalan3 Jun 14, 2024
0360114
Move back tests
aalan3 Jun 14, 2024
ba9088f
Remove
aalan3 Jun 14, 2024
ebdafc3
Fix sources
aalan3 Jun 14, 2024
14f0992
Fix
aalan3 Jun 14, 2024
5b74deb
Fix source
aalan3 Jun 14, 2024
13224bb
Add missing seeds
aalan3 Jun 14, 2024
5071fd7
Merge branch 'dex-subproject' of https://github.com/duneanalytics/spe…
jeff-dude Jun 14, 2024
d777e65
Merge branch 'main' into dex-subproject
jeff-dude Jun 14, 2024
95cc93b
clean up tests
jeff-dude Jun 14, 2024
2031a25
organize macros
jeff-dude Jun 14, 2024
35a7261
organize models
jeff-dude Jun 14, 2024
1672016
test full dex run
jeff-dude Jun 14, 2024
fe81130
Revert "test full dex run"
jeff-dude Jun 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/commit_manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: [ self-hosted, linux, spellbook-trino-ci ]
strategy:
matrix:
project: [ 'tokens', 'spellbook', 'daily_spellbook', 'nft']
project: [ 'tokens', 'spellbook', 'daily_spellbook', 'nft', 'dex']
max-parallel: 1

steps:
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/dex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: DBT DEX sector run

on:
workflow_dispatch:
pull_request:
paths:
- dex/**
- .github/workflows/dex.yml
- .github/workflows/dbt_run.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
dbt-run:
uses: ./.github/workflows/dbt_run.yml
with:
project: 'dex'
116 changes: 0 additions & 116 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,6 @@ models:
bitcoin:
+schema: cex_bitcoin

uniswap:
+schema: uniswap
arbitrum:
+schema: uniswap_arbitrum
ethereum:
+schema: uniswap_ethereum
optimism:
+schema: uniswap_optimism
polygon:
+schema: uniswap_polygon
bnb:
+schema: uniswap_bnb
base:
+schema: uniswap_base
celo:
+schema: uniswap_celo

balances:
+schema: balances
ethereum:
Expand All @@ -114,21 +97,6 @@ models:
polygon:
+schema: balances_polygon

dodo:
+schema: dodo
ethereum:
+schema: dodo_ethereum
bnb:
+schema: dodo_bnb
polygon:
+schema: dodo_polygon
arbitrum:
+schema: dodo_arbitrum
optimism:
+schema: dodo_optimism
base:
+schema: dodo_base

labels:
+schema: labels
+materialized: table
Expand All @@ -150,11 +118,6 @@ models:
solana_utils:
+schema: solana_utils

odos:
+schema: odos
avalanche_c:
+schema: odos_avalanche_c

transfers:
+schema: transfers
ethereum:
Expand Down Expand Up @@ -200,13 +163,6 @@ models:
base:
+schema: safe_base

lifi:
+schema: lifi
fantom:
+schema: lifi_fantom
optimism:
+schema: lifi_optimism

aragon:
+schema: aragon
ethereum:
Expand All @@ -220,11 +176,6 @@ models:
arbitrum:
+schema: aragon_arbitrum

spiritswap:
+schema: spiritswap
fantom:
+schema: spiritswap_fantom

jarvis_network:
+schema: jarvis_network
polygon:
Expand All @@ -240,11 +191,6 @@ models:
bnb:
+schema: spaceid_bnb

spartacus_exchange:
+schema: spartacus_exchange
fantom:
+schema: spartacus_exchange_fantom

tornado_cash:
+schema: tornado_cash
arbitrum:
Expand Down Expand Up @@ -302,15 +248,6 @@ models:
ethereum:
+schema: fiat_dao_ethereum

curvefi:
+schema: curvefi
ethereum:
+schema: curvefi_ethereum
optimism:
+schema: curvefi_optimism
fantom:
+schema: curvefi_fantom

cow_protocol:
+schema: cow_protocol
ethereum:
Expand Down Expand Up @@ -340,21 +277,6 @@ models:
avalanche_c:
+schema: yield_yak_avalanche_c

kyberswap:
+schema: kyberswap
avalanche_c:
+schema: kyberswap_avalanche_c
optimism:
+schema: kyberswap_optimism
ethereum:
+schema: kyberswap_ethereum
arbitrum:
+schema: kyberswap_arbitrum
bnb:
+schema: kyberswap_bnb
polygon:
+schema: kyberswap_polygon

hashflow:
+schema: hashflow
ethereum:
Expand All @@ -369,25 +291,6 @@ models:
ethereum:
+schema: nexusmutual_ethereum

zeroex:
+schema: zeroex
ethereum:
+schema: zeroex_ethereum
optimism:
+schema: zeroex_optimism
polygon:
+schema: zeroex_polygon
avalanche_c:
+schema: zeroex_avalanche_c
fantom:
+schema: zeroex_fantom
arbitrum:
+schema: zeroex_arbitrum
bnb:
+schema: zeroex_bnb
celo:
+schema: zeroex_celo


ampleforth:
+schema: ampleforth
Expand Down Expand Up @@ -471,11 +374,6 @@ models:
ethereum:
+schema: tokenfy_ethereum

tokenlon:
+schema: tokenlon
ethereum:
+schema: tokenlon_ethereum

thales:
+schema: thales
ethereum:
Expand Down Expand Up @@ -569,11 +467,6 @@ models:
polygon:
+schema: rocifi_polygon

oneinch:
+schema: oneinch
ethereum:
+schema: oneinch_ethereum

pooltogether:
+schema: pooltogether
ethereum:
Expand Down Expand Up @@ -628,15 +521,6 @@ models:
base:
+schema: layerzero_base

bebop:
+schema: bebop
ethereum:
+schema: bebop_ethereum
polygon:
+schema: bebop_polygon
arbitrum:
+schema: bebop_arbitrum

tokemak:
+schema: tokemak
ethereum:
Expand Down
11 changes: 11 additions & 0 deletions dex/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## DEX subproject

This is a DBT subproject for the main lineages of the DEX sector. Included in this subproject, but not limited to over time:
- `dex.trades`
- `dex_aggreagtor.trades`
- `dex.prices`
- `dex.sandwiches`
- `dex.sandwiched`
- ...and more!

This subproject will be dedicated to building the above spells (and others in the future related to DEX) on an hourly cadence in production. All other spells not included within this subproject will treat these spells as sources. For example, labels spells which read from `dex.trades` will now treat the spell as a source, rather than reference within dbt.
67 changes: 67 additions & 0 deletions dex/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#Welcome to your Spellbook!

name: "dex"
version: "1.0.0"
config-version: 2

quoting:
database: false
schema: false
identifier: false

# This setting configures which "profile" dbt uses for this project.
profile: "spellbook-local"

vars:
DBT_ENV_CUSTOM_ENV_S3_BUCKET: "{{ env_var('DBT_ENV_CUSTOM_ENV_S3_BUCKET', 'local') }}"
DBT_ENV_INCREMENTAL_TIME: "{{ env_var('DBT_ENV_INCREMENTAL_TIME', '1') }}"
DBT_ENV_INCREMENTAL_TIME_UNIT: "{{ env_var('DBT_ENV_INCREMENTAL_TIME_UNIT', 'day') }}"

# These configurations specify where dbt should look for different types of files.
# You don't need to change these!
model-paths: ["models", "../sources"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros", "../macros"]
snapshot-paths: ["snapshots"]

target-path: "target" # directory which will store compiled SQL files
clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"

# Configuring tests
# Full documentation: https://docs.getdbt.com/reference/test-configs
tests:
dex:
+store_failures: true # store failures for all tests

# Configuring seeds
# Full documentation: https://docs.getdbt.com/reference/seed-configs
# For configuring individual seeds (e.g. overriding column types) we recommend a yml file nested in the same folder as the seed
seeds:
dex:
+schema: test_data

# defining search order of macro invokation
dispatch:
- macro_namespace: dbt_utils
search_order: ['trino_utils', 'dbt_utils']

# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models
models:
dex:
+post-hook:
- sql: "{{ set_trino_session_property(is_materialized(model), 'writer_scaling_min_data_processed', model.config.get('writer_min_size', '500MB')) }}"
transaction: true
- sql: "{{ set_trino_session_property(is_materialized(model), 'task_scale_writers_enabled', false) }}"
transaction: true
- sql: "{{ optimize_spell(this, model.config.materialized) }}"
transaction: true
- sql: "{{ mark_as_spell(this, model.config.materialized) }}"
transaction: true
+materialized: view
+schema: no_schema # this should be overriden in model specific configs
+view_security: invoker
Loading
Loading