Overview
Phase D follow-up of the aggregator profiling task (#1375, phases A+B merged as #1376 + autofit_workspace_test#48). The sqlite results database (autofit/database/) has two paths: build-from-directory (scrape) and direct-write during a fit (session). Neither has been used in a long time and the direct-write path is suspected buggy. Goal: exercise both with the merged mock-results harness, fix the cheap bugs, and produce a written where-it's-at assessment for whatever isn't cheap — explicitly per the original prompt: "If its hard to fix dont bother, but its good to work out where its at."
Plan
- Run the existing
autofit_workspace_test/scripts/database/{directory,scrape,session} scripts against current main — record which still pass, triage what fails.
- Exercise the scrape/build path at scale using the merged mock-results generator (
scripts/profiling/aggregator/mock_results.py); fix bugs where cheap.
- Extend the profiling grid with database stages (build time, query time) so sqlite loading can be compared against the directory
Aggregator — answering "when is building the database worth it?".
- Assess the session/direct-write path: fix if cheap, otherwise a written assessment (what works, what's broken, what a fix would take) posted to this issue.
- Assessment-first: source edits happen only after the failure survey, with the fix plan checkpointed.
Detailed implementation plan
Work Classification
Both (library + workspace) — bug workflow.
Worktree root
~/Code/PyAutoLabs-wt/aggregator-sqlite/
Affected Repositories
- PyAutoFit (primary —
autofit/database/: aggregator/scrape.py, aggregator/aggregator.py, model/, sqlalchemy_.py, migration/)
- autofit_workspace_test (
scripts/database/, scripts/profiling/aggregator/)
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoFit |
main |
clean |
| ./autofit_workspace_test |
main |
clean |
Suggested branch: feature/aggregator-sqlite
Implementation Steps
- Survey: run
scripts/database/directory/*.py, scripts/database/scrape/*.py, scripts/database/session/*.py under PYAUTO_TEST_MODE; tabulate pass/fail + tracebacks.
- Scale exercise: mock N=100/1000 result sets →
af.Aggregator(database file) scrape/add_directory; catalogue failures.
- Cheap fixes in
autofit/database/ with unit tests (numpy-only).
- Profiling stage: add
database_build + database_query stages to profile_aggregator.py (or a sibling profile_database.py).
- Session/direct-write assessment; cheap fixes or written verdict on this issue.
Key Files
PyAutoFit/autofit/database/aggregator/scrape.py — build-from-directory path
PyAutoFit/autofit/database/aggregator/aggregator.py — sqlite Aggregator + queries
PyAutoFit/autofit/non_linear/paths/database.py — direct-write (session) paths
autofit_workspace_test/scripts/database/ — existing coverage
autofit_workspace_test/scripts/profiling/aggregator/ — merged harness to reuse
Verification
- Existing database scripts pass (or failures documented with tracebacks and triage).
pytest test_autofit/database/ (plus aggregator subtree) green.
- Profiling table showing database build/query vs directory-aggregator loading on the same mock sets.
Original Prompt
Click to expand starting prompt
Phase D follow-up of the aggregator profiling task (PyAutoFit#1375; phases A+B merged as PyAutoFit#1376 + autofit_workspace_test#48). Original goal 3 of that prompt, verbatim:
"dont work on sqlite database builds on 1 or 2, but then do a follow up where you use this functionality, inevitably encounter and fix bugs for its use, and assess the code which writes directly to the sqlite database, which has not been used in a long time and I'm sure is buggy. If its hard to fix dont bother, but its good to work out where its at."
Concretely, in PyAutoFit (autofit/database/) driven from autofit_workspace_test:
-
Use the merged mock-results harness (scripts/profiling/aggregator/mock_results.py) to exercise the sqlite build-from-directory path (autofit/database/aggregator/scrape.py, af.Aggregator(database file) + add_directory) at scale; fix the bugs encountered where they are cheap; extend the profiling grid with a database-build + database-query stage so sqlite loading can be compared against the directory Aggregator.
-
Assess the direct-write path (session-based writing during a fit, database.py paths) — long unused and suspected buggy. Fix if cheap; otherwise produce a written where-it's-at assessment (what works, what is broken, what it would take) rather than sinking time.
-
The existing scripts/database/{directory,scrape,session}/ scripts in autofit_workspace_test are the current coverage — run them, note which still pass.
Overview
Phase D follow-up of the aggregator profiling task (#1375, phases A+B merged as #1376 + autofit_workspace_test#48). The sqlite results database (
autofit/database/) has two paths: build-from-directory (scrape) and direct-write during a fit (session). Neither has been used in a long time and the direct-write path is suspected buggy. Goal: exercise both with the merged mock-results harness, fix the cheap bugs, and produce a written where-it's-at assessment for whatever isn't cheap — explicitly per the original prompt: "If its hard to fix dont bother, but its good to work out where its at."Plan
autofit_workspace_test/scripts/database/{directory,scrape,session}scripts against current main — record which still pass, triage what fails.scripts/profiling/aggregator/mock_results.py); fix bugs where cheap.Aggregator— answering "when is building the database worth it?".Detailed implementation plan
Work Classification
Both (library + workspace) — bug workflow.
Worktree root
~/Code/PyAutoLabs-wt/aggregator-sqlite/Affected Repositories
autofit/database/:aggregator/scrape.py,aggregator/aggregator.py,model/,sqlalchemy_.py,migration/)scripts/database/,scripts/profiling/aggregator/)Branch Survey
Suggested branch:
feature/aggregator-sqliteImplementation Steps
scripts/database/directory/*.py,scripts/database/scrape/*.py,scripts/database/session/*.pyunder PYAUTO_TEST_MODE; tabulate pass/fail + tracebacks.af.Aggregator(database file)scrape/add_directory; catalogue failures.autofit/database/with unit tests (numpy-only).database_build+database_querystages toprofile_aggregator.py(or a siblingprofile_database.py).Key Files
PyAutoFit/autofit/database/aggregator/scrape.py— build-from-directory pathPyAutoFit/autofit/database/aggregator/aggregator.py— sqlite Aggregator + queriesPyAutoFit/autofit/non_linear/paths/database.py— direct-write (session) pathsautofit_workspace_test/scripts/database/— existing coverageautofit_workspace_test/scripts/profiling/aggregator/— merged harness to reuseVerification
pytest test_autofit/database/(plus aggregator subtree) green.Original Prompt
Click to expand starting prompt
Phase D follow-up of the aggregator profiling task (PyAutoFit#1375; phases A+B merged as PyAutoFit#1376 + autofit_workspace_test#48). Original goal 3 of that prompt, verbatim:
"dont work on sqlite database builds on 1 or 2, but then do a follow up where you use this functionality, inevitably encounter and fix bugs for its use, and assess the code which writes directly to the sqlite database, which has not been used in a long time and I'm sure is buggy. If its hard to fix dont bother, but its good to work out where its at."
Concretely, in PyAutoFit (autofit/database/) driven from autofit_workspace_test:
Use the merged mock-results harness (scripts/profiling/aggregator/mock_results.py) to exercise the sqlite build-from-directory path (autofit/database/aggregator/scrape.py, af.Aggregator(database file) + add_directory) at scale; fix the bugs encountered where they are cheap; extend the profiling grid with a database-build + database-query stage so sqlite loading can be compared against the directory Aggregator.
Assess the direct-write path (session-based writing during a fit, database.py paths) — long unused and suspected buggy. Fix if cheap; otherwise produce a written where-it's-at assessment (what works, what is broken, what it would take) rather than sinking time.
The existing scripts/database/{directory,scrape,session}/ scripts in autofit_workspace_test are the current coverage — run them, note which still pass.