Skip to content

fix: preserve SQLite factory connection options on copy and unpickle - #957

Merged
elijahbenizzy merged 1 commit into
apache:mainfrom
MIRS571:fix/sqlite-factory-connect-options
Oct 17, 2026
Merged

elijahbenizzy merged 1 commit into
apache:mainfrom
MIRS571:fix/sqlite-factory-connect-options

Conversation

@MIRS571

@MIRS571 MIRS571 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

SQLitePersister.from_values() applies connect_kwargs to its initial connection but does not retain them on the persister. Consequently, copy() and pickle restoration open new connections with SQLite defaults. from_config() inherits the same behavior.

For example, a factory-created persister with timeout=0.123 and check_same_thread=False changes to a 5000 ms busy timeout after copying, and reading it from a worker thread raises sqlite3.ProgrammingError.

Changes

  • Forward connect_kwargs to the constructed SQLitePersister so the existing copy/unpickle paths retain them.
  • Correct the synchronous factory docstring and document option retention.
  • Add four regression cases covering from_values/from_config and copy/pickle, checking actual timeout values, independent connections, and checkpoint reads from a worker thread.
  • Keep the change limited to burr/core/persistence.py and tests/core/test_persistence.py; no new dependencies or database schema changes.

How I tested this

  • Against upstream f8488d0, all four new regression cases fail with 5000 != 123.
  • With the fix, python -m pytest tests/core/test_persistence.py tests/core/test_parallelism.py tests/core/test_application.py -q completed with 193 passed on Windows / Python 3.11.2.
  • The changed files passed Black 23.11.0, isort 5.12.0, Flake8 6.1.0 (single worker), ASF header, AST, end-of-file, trailing-whitespace and git diff --check checks. pip check also passed.
  • Additional local checks covered 24 constructor/reconstruction/options combinations and read-only SQLite URI restoration.
  • Tests used local SQLite files and worker threads; no paid model APIs or external database services were used.

Notes

Prepared with OpenAI Codex assistance. The validation above was performed with Codex assistance and is not an independent human test run. No code from another project was introduced.

The full repository test matrix, full pre-commit entry point, frontend hook and complete CI have not been run locally. Applicable Python checks were run individually. Local testing does not establish compatibility with arbitrary external subclasses or unpicklable connection options. Preserving check_same_thread=False does not make arbitrary concurrent writes safe.

Generated-by: OpenAI Codex

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered. Applicable Python checks passed individually; the full pre-commit entry point and frontend hook were not run.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output). N/A: no new public functions; the existing factory docstring was corrected.
  • Placeholder code is flagged / future TODOs are captured in comments. N/A: no placeholder code or new TODOs were introduced.
  • Project documentation has been updated if adding/changing functionality. The factory docstring now documents connection-option retention.

@github-actions github-actions Bot added area/core Application, State, Graph, Actions area/storage Persisters, state storage labels Oct 14, 2026

@elijahbenizzy elijahbenizzy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Straightforward plumbing -- the constructor already retained _connect_kwargs, from_values just never passed them. Thanks for the docstring fix too. Elijah

@elijahbenizzy
elijahbenizzy enabled auto-merge (squash) October 17, 2026 15:29
@elijahbenizzy
elijahbenizzy merged commit 2dcf75c into apache:main Oct 17, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Application, State, Graph, Actions area/storage Persisters, state storage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants