fix: exempt a SQLite file: URI with an empty path from the one-database check

Open Beginner friendly
#180 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
django, python, sqlite
Domain
database

Research direction

The pair check is databases_problems in neolith/_databases.py, which compares paths through sqlite_path and _identity; start by reading how sqlite_path returns an empty string for file:?mode=memory and file:?cache=private. Exempt an empty path from the pair check the same way the literal :memory: is already exempt. Done when the reproduction in the issue returns no problem for the pair, and each alias is still refused individually with neolith.E018.

Written by the indexing model from the issue text.

Description

Reproduction

On release/0.1.0a4 (07b71c6):

from neolith._databases import databases_problems

lite = "django.db.backends.sqlite3"
databases_problems(
    {
        "ledger": {"ENGINE": lite, "NAME": "file:?mode=memory"},
        "billing": {"ENGINE": lite, "NAME": "file:?cache=private"},
    },
    ["ledger", "billing"],
)

gives ['databases ledger and billing: both name django.db.backends.sqlite3 '] (after #171: both name one SQLite file). sqlite_path returns '' for both, which its docstring calls a private temporary database that names no file, and _identity compares that empty path.

Expected

An empty path names no file, so it is exempt from the pair check, as the literal :memory: is. Boot then refuses each alias on its own (neolith.E018).

Dominant language
Python
Stars
1
Forks
0
Avg merge
6h 34m
Merged PRs (30d)
108

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stack314/django-neolith

All issues in stack314/django-neolith

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.