We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Currently, I have a bunch of code that looks like this:
subjects = db["subjects"] if db["subjects"].exists() else db["subjects"].create({ ... })
It would be neat if sqlite-utils could simplify that by supporting CREATE TABLE IF NOT EXISTS, so that I'd be able to write, e.g.
CREATE TABLE IF NOT EXISTS
subjects = db["subjects"].create({...}, if_not_exists=True)
The text was updated successfully, but these errors were encountered:
This is a good idea. We already have that parameter for the table.create_index() method: https://sqlite-utils.datasette.io/en/stable/reference.html#sqlite_utils.db.Table.create_index
table.create_index()
Sorry, something went wrong.
Just noticed there's no explicit test coverage for the db["table"].create(...) method.
db["table"].create(...)
Basic test for db[t].create(...), refs #397
79b5b58
aa24903
Updated documentation is here: https://sqlite-utils.datasette.io/en/latest/python-api.html#explicitly-creating-a-table
sqlite-utils create-table
--if-not-exists
Release 3.24
757f103
Refs ##397, #398, #401, #403, #404, #405, #407
No branches or pull requests
Currently, I have a bunch of code that looks like this:
It would be neat if sqlite-utils could simplify that by supporting
CREATE TABLE IF NOT EXISTS
, so that I'd be able to write, e.g.The text was updated successfully, but these errors were encountered: