feat(cli): iaf index + SqliteBacktestIndex — epic #540 phase 2#542
Merged
Conversation
Tier-1 SQLite index over a folder of .iafbt bundles, building on the phase-1 BacktestIndexRow contract. * services/backtest_index/sqlite_index.py: SqliteBacktestIndex with create / open / upsert / upsert_many / iter_rows / query. Every scalar field of BacktestSummaryMetrics is promoted to its own summary_<name> SQL column so analysts can filter without opening any bundle (e.g. WHERE summary_sharpe_ratio > 1.0). parameters / strategy_ids / extras round-trip as JSON text. WAL mode for safe concurrent reads. Forward-only additive schema migration via PRAGMA user_version. * cli/index_command.py + new 'iaf index <bundle-dir>' click command: walks the directory, opens each bundle with summary_only=True (no Parquet metric-blob decode), derives BacktestIndexRow, upserts. --output, --absolute-paths and --no-progress flags. * docs/design/tiered-backtest-storage.md updated with phase-2 status. Tests: 12 new (8 SqliteBacktestIndex unit tests + 4 CLI integration tests via click.testing.CliRunner). Full repo suite green (1698 passed, 42 skipped). Lint clean.
ae91338 to
c4d30d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #541 (phase 1). Phase 2 of epic #540 — SQLite Tier-1 index.
What
New
SqliteBacktestIndexservice (investing_algorithm_framework.services.backtest_index) — single-file SQLite database with one row per bundle. Every scalar field ofBacktestSummaryMetricsis promoted to its ownsummary_<name>SQL column, so analysts can filter ad-hoc without opening any bundle:New
iaf index <bundle-dir>CLI: walks the folder, opens each.iafbtwithsummary_only=True(no Parquet decode), derives aBacktestIndexRow, upserts. Flags:--output,--absolute-paths,--no-progress.Schema details:
PRAGMA user_version— older index files get missing columns added in place.parameters/strategy_ids/extrasround-trip as JSON text columns; non-canonical summary fields land insummary_extras_json(forward-compat).Tests
12 new tests:
SqliteBacktestIndexunit tests (lifecycle, upsert PK enforcement, round-trip, replace-on-duplicate, bulk upsert, parameterised query, build-from-real-bundle).click.testing.CliRunner(relative vs absolute paths, custom output, full Click invocation).Full repo suite: 1698 passed, 42 skipped, 47 subtests passed. Lint clean.
Stacking
Base is
feature/index-row(#541) which is itself stacked onfeature/bundle-format-v2(#537). Once #537 + #541 merge, this PR's base auto-walks down todev.Tracks epic #540 — phase 2 of 3. Phase 3 (
BacktestStore+LocalTieredStore) is the remaining work.