dblite
1.3.0
Simple query interface for SQL databases
|
Public Member Functions | |
def | insert (self, table, values=(), **kwargs) |
Convenience wrapper for database INSERT, returns inserted row ID. More... | |
def | insertmany (self, table, rows=(), **kwargs) |
Convenience wrapper for database multiple INSERTs, returns list of inserted row IDs. More... | |
def | makeSQL (self, action, table, cols="*", where=(), group=(), order=(), limit=(), values=(), kwargs=None) |
Returns (SQL statement string, parameter dict). More... | |
def | quote (cls, value, force=False) |
Returns identifier in quotes and proper-escaped for queries, if value needs quoting (has non-alphanumerics, starts with number, or is reserved). More... | |
Public Member Functions inherited from dblite.api.Queryable | |
def | delete (self, table, where=(), **kwargs) |
Convenience wrapper for database DELETE, returns affected row count. More... | |
def | execute (self, sql, args=()) |
Executes the SQL statement and returns database cursor. More... | |
def | executemany (self, sql, args) |
Executes the SQL statement against all parameter sequences. More... | |
def | executescript (self, sql) |
Executes the SQL as script of any number of statements. More... | |
def | fetchall (self, table, cols="*", where=(), group=(), order=(), limit=(), **kwargs) |
Convenience wrapper for database SELECT and fetch all. More... | |
def | fetchone (self, table, cols="*", where=(), group=(), order=(), limit=(), **kwargs) |
Convenience wrapper for database SELECT and fetch one. More... | |
def | select (self, table, cols="*", where=(), group=(), order=(), limit=(), **kwargs) |
Convenience wrapper for database SELECT, returns database cursor. More... | |
def | update (self, table, values, where=(), **kwargs) |
Convenience wrapper for database UPDATE, returns affected row count. More... | |
Static Public Attributes | |
string | ENGINE = "sqlite" |
Name of underlying database engine. More... | |
list | OPS |
Recognized binary operators for makeSQL() More... | |
Static Public Attributes inherited from dblite.api.Queryable | |
ENGINE = None | |
Underlying database engine, "sqlite" for SQLite3 and "postgres" for PostgreSQL. More... | |
Additional Inherited Members | |
Properties inherited from dblite.api.Queryable | |
closed = property | |
Whether currently not open. More... | |
cursor = property | |
Database engine cursor object, or `None` if closed. More... | |
def dblite.engines.sqlite.Queryable.insert | ( | self, | |
table, | |||
values = () , |
|||
** | kwargs | ||
) |
Convenience wrapper for database INSERT, returns inserted row ID.
Keyword arguments are added to VALUES.
Reimplemented from dblite.api.Queryable.
def dblite.engines.sqlite.Queryable.insertmany | ( | self, | |
table, | |||
rows = () , |
|||
** | kwargs | ||
) |
Convenience wrapper for database multiple INSERTs, returns list of inserted row IDs.
Keyword arguments are added to VALUES of every single row, overriding individual row values.
Reimplemented from dblite.api.Queryable.
def dblite.engines.sqlite.Queryable.makeSQL | ( | self, | |
action, | |||
table, | |||
cols = "*" , |
|||
where = () , |
|||
group = () , |
|||
order = () , |
|||
limit = () , |
|||
values = () , |
|||
kwargs = None |
|||
) |
Returns (SQL statement string, parameter dict).
Reimplemented from dblite.api.Queryable.
def dblite.engines.sqlite.Queryable.quote | ( | cls, | |
value, | |||
force = False |
|||
) |
Returns identifier in quotes and proper-escaped for queries, if value needs quoting (has non-alphanumerics, starts with number, or is reserved).
value | the value to quote, returned as-is if not string |
force | whether to quote value even if not required |
Reimplemented from dblite.api.Queryable.
|
static |
|
static |