[New-bugs-announce] [issue46402] Enhance sqlite3 to avoid implicit creation?

Ned Batchelder report at bugs.python.org
Sun Jan 16 12:42:31 EST 2022


New submission from Ned Batchelder <ned at nedbatchelder.com>:

The sqlite3 library implicitly creates the database if the requested file doesn't exist.  I would like to be able to avoid that implicit creation.  (Actually, it would be enough to know whether I had created the database, but the underlying SQLite library doesn't seem to indicate that.)

The C code currently hard-codes the SQLite flag to create the database if it doesn't exist:

    rc = sqlite3_open_v2(database, &db,
                         SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
                         (uri ? SQLITE_OPEN_URI : 0), NULL);

Could we make this an option, so the Python code could avoid implicit creation?

----------
components: Library (Lib)
messages: 410704
nosy: nedbat
priority: normal
severity: normal
status: open
title: Enhance sqlite3 to avoid implicit creation?

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46402>
_______________________________________


More information about the New-bugs-announce mailing list