Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add URI filename support #670

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
fry69 wants to merge 1 commit into simonw:main
base: main
Choose a base branch
Loading
from fry69:fry69/issue650
Open

Conversation

@fry69
Copy link

@fry69 fry69 commented Oct 10, 2025
edited by github-actions bot
Loading

fix #650

This code was generated with VS Code Copilot agent and Sonnet-4.5.

I think it did its job quite well.

Generated PR message below


Add SQLite URI filename support

Implements support for SQLite URI filenames across CLI and Python API (fixes #650).

Changes

sqlite_utils/db.py:

  • Modified Database.__init__() to detect URI filenames (strings starting with ) and pass uri=True parameter to sqlite3.connect()

sqlite_utils/cli.py:

  • Added DatabasePath class extending click.Path to handle URI filenames
  • URIs bypass file existence validation while maintaining normal validation for regular paths
  • Replaced all database path parameters throughout CLI with DatabasePath

tests/test_uri.py:

  • Added comprehensive test coverage for URI functionality
  • Tests include: read-only mode, immutable flag, multiple parameters, CLI commands, path validation

Documentation:

  • Added URI filenames section to CLI documentation
  • Added URI examples to Python API documentation

Usage

CLI:

sqlite-utils tables 'file:data.db?mode=ro&immutable=1'
sqlite-utils query 'file:data.db?mode=ro' "SELECT * FROM items"

Python API:

from sqlite_utils import Database
db = Database("file:data.db?mode=ro&immutable=1")

Testing

All existing tests pass. Added 13 new tests covering URI functionality. Type checking passes with mypy.


📚 Documentation preview 📚: https://sqlite-utils--670.org.readthedocs.build/en/670/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Ability to pass a URI to the CLI tools

1 participant

AltStyle によって変換されたページ (->オリジナル) /