fix: Apply SQLite optimizations to the custom connection_string in SqlStorageClient#1837
Open
Mantisus wants to merge 2 commits intoapify:masterfrom
Open
fix: Apply SQLite optimizations to the custom connection_string in SqlStorageClient#1837Mantisus wants to merge 2 commits intoapify:masterfrom
connection_string in SqlStorageClient#1837Mantisus wants to merge 2 commits intoapify:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Applies SQLite concurrency/performance pragmas (notably journal_mode=WAL) even when SqlStorageClient is configured via a custom SQLite connection_string, rather than only for the default database path.
Changes:
- Replace the “default DB only” gate with a SQLite-specific optimization gate based on the provided
connection_string. - Ensure SQLite pragmas are executed during initialization for SQLite connection strings when
engineis not explicitly provided. - Update
uv.lockmetadata/options for dependency resolution reproducibility.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
uv.lock |
Adds uv lock options (exclude-newer, span) affecting how the lock was produced/resolved. |
src/crawlee/storage_clients/_sql/_storage_client.py |
Expands SQLite pragma application to custom SQLite connection_string configurations (when engine is not provided). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
janbuchar
reviewed
Apr 7, 2026
| # Flag needed to apply optimizations only for default database | ||
| self._default_flag = self._engine is None and self._connection_string is None | ||
| # Flag needed to apply optimizations only for SQLite database | ||
| self._optimization_flag = self._engine is None and ( |
Collaborator
There was a problem hiding this comment.
Could we instead set up an _on_connect callback here that would receive the new DB connection? That way, the logic (if sqlite, set up some pragmas) would be in one place.
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.
Description
crawleecan have highly concurrent access to the database, SQLite optimizations must be applied, the most critical beingjournal_mode=WAL. If a user wants fine-grained control over connections, they should pass a customengineinstead of a 'connection_string'.Issues