Skip to content

Support IF NOT EXISTS for table creation #397

@rafguns

Description

@rafguns

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.

subjects = db["subjects"].create({...}, if_not_exists=True)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions