Skip to content

feat: support urlbased config for sqlite #3853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

xujihui1985
Copy link

Does your PR solve an issue?
This PR introduces support for configuring journal_mode and busy_timeout via the SQLite database URL, improving ergonomics and aligning with behavior in other ecosystems.

Currently, libraries like SeaORM do not expose journal_mode and busy_timeout through DatabaseConfig, which requires users to manually run PRAGMA commands after establishing a connection. This adds complexity and boilerplate. By allowing these settings to be specified in the URL itself, usage becomes much simpler and declarative.

This feature mirrors existing functionality in other SQLite libraries such as the Go SQLite driver mattn/go-sqlite3, which supports these parameters in the DSN.

Example usage:

sqlite://app.db?_journal_mode=WAL&_busy_timeout=5000

Is this a breaking change?
No, this is not a breaking change. Existing URLs will continue to work as before, and the new configuration options are optional and additive.

Additional context
This change improves developer experience by eliminating the need to execute manual PRAGMA statements by using sea-orm and allows consistent configuration via connection string.

Unit and/or integration tests have been added to verify that journal_mode and busy_timeout are correctly parsed and applied from the URL configuration.

@xujihui1985 xujihui1985 force-pushed the feat/sqlite-urlbased-config branch from 5716dd6 to 8697fa7 Compare May 3, 2025 08:05
support journal_mode and busy_timeout on sqlite url config

Signed-off-by: xujihui1985 <[email protected]>
@xujihui1985 xujihui1985 force-pushed the feat/sqlite-urlbased-config branch from 8697fa7 to 82390b5 Compare May 3, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant