### Install Dependencies Source: https://github.com/duneanalytics/spellbook/blob/main/scripts/integration_test/README.md Installs project dependencies using uv. Run this from the root of the spellbook repository. ```bash uv sync --locked ``` -------------------------------- ### Install Pre-push Hooks Source: https://github.com/duneanalytics/spellbook/blob/main/CONTRIBUTING.md Installs the pre-push hooks for the dbt project. Ensure dependencies are synced first. ```bash uv sync --locked ``` ```bash uv run pip freeze ``` ```bash uv run pre-commit install --hook-type pre-push ``` -------------------------------- ### Sector-level Model Directory Example (Platforms) Source: https://github.com/duneanalytics/spellbook/blob/main/docs/models/model_overview.md Example of a directory path for sector-level models within a dedicated sub-project, specifically for platform data. ```sql dbt_subprojects/dex/models/trades/arbitrum/platforms/ ``` -------------------------------- ### Project-level Model Directory Example Source: https://github.com/duneanalytics/spellbook/blob/main/docs/models/model_overview.md Example of a directory path for project-level models, typically used for cross-project or specific application data. ```sql dbt_subprojects/daily_spellbook/models/_project/aave/ethereum/ ``` -------------------------------- ### Sector-level Model Directory Example (Daily/Hourly Spellbook) Source: https://github.com/duneanalytics/spellbook/blob/main/docs/models/model_overview.md Example of a directory path for sector-level models within the daily or hourly spellbook, using the '_sector' prefix for organization. ```sql dbt_subprojects/hourly_spellbook/models/_sector/gas/fees/arbitrum/ ``` -------------------------------- ### All EVM Chains Macro Example Source: https://github.com/duneanalytics/spellbook/blob/main/docs/macros/macro_overview.md This SQL file, `all_evm_chains.sql`, is an example of a macro used within the `dbt_macros/shared` directory. It can be utilized in models for iterating over a list of EVM chains. ```sql dbt_macros/shared/all_evm_chains.sql ``` -------------------------------- ### Example Macro File Structure Source: https://github.com/duneanalytics/spellbook/blob/main/docs/macros/macro_overview.md Macros are organized under `dbt_subprojects//macros/models/`, mirroring the structure of the models directory. This example shows a common structure for project-specific spell lineages. ```sql dbt_subprojects//macros/ ``` -------------------------------- ### Partitioning Strategy Examples Source: https://github.com/duneanalytics/spellbook/blob/main/docs/models/model_config_block.md Examples of common partitioning strategies for large tables. Choose partitioning columns that are frequently used in WHERE clauses, GROUP BYs, or JOIN conditions to optimize query performance. Avoid overly granular columns like block_number or block_time. ```python partition_by=['block_month'] ``` ```python partition_by=['block_date'] ``` ```python partition_by=['blockchain', 'project', 'block_month'] ``` -------------------------------- ### Install Python Version with uv Source: https://github.com/duneanalytics/spellbook/blob/main/README.md If the initial dependency installation fails due to a Python version mismatch, use this command to install Python 3.9. After installation, re-run 'uv sync --locked'. ```bash uv python install 3.9 ``` -------------------------------- ### Example Granularity Path Source: https://github.com/duneanalytics/spellbook/blob/main/docs/general/sector_spell_design.md Illustrates the hierarchical path of data granularity from project-specific models to sector-wide spells. ```text uniswap_v1_ethereum.base_trades → dex_ethereum.base_trades → dex.base_trades → dex.trades ``` -------------------------------- ### Uniswap Compatible Trades Macro Example Source: https://github.com/duneanalytics/spellbook/blob/main/docs/macros/macro_overview.md This SQL file contains macros for handling Uniswap compatible trades. It serves as an example for organizing project-specific macro code, adhering to principles of argument assignment and parameterization. ```sql dbt_subprojects/dex/macros/models/_project/uniswap_compatible_trades.sql ```