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

DAT-2194; Substreams SQL; Uniswap v2; Add DBT models #154

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 112 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
"eth-supply",
"synthetix",
"aave-v2",
"sql/uniswap_v2",
]
exclude = ["messari-cli"]

Expand Down
29 changes: 29 additions & 0 deletions sql/dbt/logs/dbt.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
19:23:45.911835 [debug] [MainThread]: Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'start', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f40c7c24ee0>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f40c5fa0fa0>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f40c5fa0a30>]}


============================== 19:23:45.953718 | 8f48e584-280b-4320-a367-b327ed9233a0 ==============================
19:23:45.953718 [info ] [MainThread]: Running with dbt=1.7.4
19:23:45.955099 [debug] [MainThread]: running dbt with arguments {'printer_width': '80', 'indirect_selection': 'eager', 'write_json': 'True', 'log_cache_events': 'False', 'partial_parse': 'True', 'cache_selected_only': 'False', 'warn_error': 'None', 'debug': 'False', 'profiles_dir': '/home/harsh9200/.dbt', 'log_path': 'logs', 'fail_fast': 'False', 'version_check': 'True', 'use_colors': 'True', 'use_experimental_parser': 'False', 'no_print': 'None', 'quiet': 'False', 'warn_error_options': 'WarnErrorOptions(include=[], exclude=[])', 'introspect': 'True', 'invocation_command': 'dbt init uniswap_v2', 'log_format': 'default', 'target_path': 'None', 'static_parser': 'True', 'send_anonymous_usage_stats': 'True'}
19:23:45.996959 [debug] [MainThread]: Starter project path: /home/harsh9200/.local/lib/python3.8/site-packages/dbt/include/starter_project
19:23:46.287730 [info ] [MainThread]:
Your new dbt project "uniswap_v2" was created!

For more information on how to configure the profiles.yml file,
please consult the dbt documentation here:

https://docs.getdbt.com/docs/configure-your-profile

One more thing:

Need help? Don't hesitate to reach out to us via GitHub issues or on Slack:

https://community.getdbt.com/

Happy modeling!

19:23:46.289001 [info ] [MainThread]: Setting up your profile.
19:24:46.788765 [info ] [MainThread]: Profile uniswap_v2 written to /home/harsh9200/.dbt/profiles.yml using target's profile_template.yml and your supplied values. Run 'dbt debug' to validate the connection.
19:24:46.793541 [debug] [MainThread]: Resource report: {"command_name": "init", "command_success": true, "command_wall_clock_time": 61.000103, "process_user_time": 3.309072, "process_kernel_time": 0.40499, "process_mem_max_rss": "93412", "process_in_blocks": "68528", "process_out_blocks": "8"}
19:24:46.794838 [debug] [MainThread]: Command `dbt init` succeeded at 19:24:46.794585 after 61.00 seconds
19:24:46.795981 [debug] [MainThread]: Sending event: {'category': 'dbt', 'action': 'invocation', 'label': 'end', 'context': [<snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f40c7c24ee0>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f40c5fa0a30>, <snowplow_tracker.self_describing_json.SelfDescribingJson object at 0x7f40c7191e20>]}
19:24:46.797016 [debug] [MainThread]: Flushing usage events
4 changes: 4 additions & 0 deletions sql/dbt/uniswap_v2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

target/
dbt_packages/
logs/
15 changes: 15 additions & 0 deletions sql/dbt/uniswap_v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Welcome to your new dbt project!

### Using the starter project

Try running the following commands:
- dbt run
- dbt test


### Resources:
- Learn more about dbt [in the docs](https://docs.getdbt.com/docs/introduction)
- Check out [Discourse](https://discourse.getdbt.com/) for commonly asked questions and answers
- Join the [chat](https://community.getdbt.com/) on Slack for live discussions and support
- Find [dbt events](https://events.getdbt.com) near you
- Check out [the blog](https://blog.getdbt.com/) for the latest news on dbt's development and best practices
Empty file.
37 changes: 37 additions & 0 deletions sql/dbt/uniswap_v2/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Name your project! Project names should contain only lowercase characters
# and underscores. A good package name should reflect your organization's
# name or the intended use of these models
name: 'uniswap_v2'
version: '1.0.0'
config-version: 2

# This setting configures which "profile" dbt uses for this project.
profile: 'uniswap_v2'

# These configurations specify where dbt should look for different types of files.
# The `model-paths` config, for example, states that models in this project can be
# found in the "models/" directory. You probably won't need to change these!
model-paths: ["models"]
analysis-paths: ["analyses"]
test-paths: ["tests"]
seed-paths: ["seeds"]
macro-paths: ["macros"]
snapshot-paths: ["snapshots"]

clean-targets: # directories to be removed by `dbt clean`
- "target"
- "dbt_packages"


# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models

# In this example config, we tell dbt to build all models in the example/
# directory as views. These settings can be overridden in the individual model
# files using the `{{ config(...) }}` macro.
models:
uniswap_v2:
# Config indicated by + and applies to all files under models/example/
example:
+materialized: view
Empty file.
13 changes: 13 additions & 0 deletions sql/dbt/uniswap_v2/models/analytics/uniswap_v2_ethereum__burn.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

with final as (
select
evt_tx_hash as transaction_hash
, evt_index as log_index
, evt_block_time as block_time
, evt_block_number as block_number
, amount0
, amount1
from burn
)

select * from final
13 changes: 13 additions & 0 deletions sql/dbt/uniswap_v2/models/analytics/uniswap_v2_ethereum__mint.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

with final as (
select
evt_tx_hash as transaction_hash
, evt_index as log_index
, evt_block_time as block_time
, evt_block_number as block_number
, amount0
, amount1
from mint
)

select * from final
Loading
Loading