An in-memory database is created using sqlite3.connect(":memory:")
with a string ":memory:"
for database
.
Since Python 3.7 sqlite3.connect
supports os.PathLike
for the database
argument.
However if one uses pathlib.Path
internally everywhere for dir/file manipulations, the ":memory:"
string cannot be passed around, as Path(":memory:")
does not fit into the pathlib.Path
philosophy.
My question is, whether database=None
could be used as an alias to ":memory:"
to create an in-memory instance.
And how about making it default, so sqlite3.connect()
without parameters creates an in-memory instance?