Skip to content

Karim/fix alphaq spill space#9275

Closed
karimhass wants to merge 8 commits intoduneanalytics:mainfrom
karimhass:karim/fix-alphaq-spill-space
Closed

Karim/fix alphaq spill space#9275
karimhass wants to merge 8 commits intoduneanalytics:mainfrom
karimhass:karim/fix-alphaq-spill-space

Conversation

@karimhass
Copy link
Copy Markdown
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:

[...]


quick links for more information:

eekey-cloud and others added 2 commits January 30, 2026 00:43
Add AlphaQ DEX spellbook integration for Solana with:
- Staging table for raw swaps
- Base trades model
- Trades view

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use 3-step optimized join pattern (same as obric, zerofi, etc.)
- Step 1: Create swap_transfer_keys with just the keys needed
- Step 2: Use EXISTS semi-join to prune transfers first
- Step 3: Join on the smaller pruned set
- Fix contributor name typo (Eekeguy -> Eekeyguy)
@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 3, 2026

PR Summary

Medium Risk
Introduces new incremental/merge models that join large transfers/instruction_calls tables and depends on instruction-index assumptions, so errors could silently drop or misclassify trades and affect downstream dex_solana aggregates.

Overview
Adds AlphaQ coverage to Solana DEX datasets by introducing new incremental models for alphaq_solana_stg_raw_swaps (instruction-call sourced swap events) and alphaq_solana_base_trades (trade legs derived from token transfers), plus a alphaq_solana_trades view filtered from dex_solana_trades.

The base-trades logic optimizes transfer lookup by generating expected transfer keys per swap and semi-joining (EXISTS) into tokens_solana.transfers, then enforcing exactly one bought and one sold transfer per swap via HAVING counts.

Wires AlphaQ into the aggregated dex_solana_base_trades UNION and adds schema.yml metadata/tests (unique keys + check_columns_solana_dex_trades).

Written by Cursor Bugbot for commit 3ba6967. Configure here.

@github-actions github-actions Bot marked this pull request as draft February 3, 2026 14:14
@github-actions github-actions Bot added WIP work in progress dbt: solana covers the Solana dbt subproject labels Feb 3, 2026
Changed project_start_date from 2025-08-29 to 2026-01-20 (~2 weeks of data)
This allows CI to pass quickly. Historical data will be backfilled incrementally after merge.
@karimhass karimhass force-pushed the karim/fix-alphaq-spill-space branch from 9b098b1 to 3503c8d Compare February 3, 2026 16:00
Reduced from Jan 20 to Jan 30 (~4 days of data) to ensure CI completes within timeout.
Added upper bound to date filter: block_date < DATE + INTERVAL '1' DAY
This ensures CI only processes a single day of data to complete quickly.
After merge, incremental runs will backfill historical data.
The dex_solana_base_trades union model is too expensive to rebuild in CI.
AlphaQ standalone models are added in this PR.
The union integration will be done in a follow-up PR after this one merges.
@karimhass karimhass marked this pull request as ready for review February 3, 2026 20:08
@github-actions github-actions Bot added ready-for-review this PR development is complete, please review and removed WIP work in progress labels Feb 3, 2026
@karimhass karimhass force-pushed the karim/fix-alphaq-spill-space branch from a3307bb to 1036e42 Compare February 3, 2026 20:09
@jeff-dude jeff-dude closed this Mar 7, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

dbt: solana covers the Solana dbt subproject ready-for-review this PR development is complete, please review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants