dblite  1.3.0
Simple query interface for SQL databases
api.py File Reference

Go to the source code of this file.

Classes

class  dblite.api.Database
 Database instance. More...
 
class  dblite.api.Queryable
 Abstract base for Database and Transaction. More...
 
class  dblite.api.Rollback
 
class  dblite.api.Transaction
 Transaction context manager, breakable by raising Rollback. More...
 

Namespaces

 dblite.api
 

Functions

def dblite.api.close (commit=None)
 Closes the default database connection, if any. More...
 
def dblite.api.delete (table, where=(), **kwargs)
 Convenience wrapper for database DELETE, returns affected row count. More...
 
def dblite.api.execute (sql, args=())
 Executes the SQL statement and returns database cursor. More...
 
def dblite.api.executemany (sql, args)
 Executes the SQL statement against all parameter sequences. More...
 
def dblite.api.executescript (sql)
 Executes the SQL as script of any number of statements. More...
 
def dblite.api.fetchall (table, cols="*", where=(), group=(), order=(), limit=(), **kwargs)
 Convenience wrapper for database SELECT and fetch all. More...
 
def dblite.api.fetchone (table, cols="*", where=(), group=(), order=(), limit=(), **kwargs)
 Convenience wrapper for database SELECT and fetch one. More...
 
def dblite.api.init (opts=None, engine=None, **kwargs)
 Returns a Database object. More...
 
def dblite.api.insert (table, values=(), **kwargs)
 Convenience wrapper for database INSERT, returns inserted row ID. More...
 
def dblite.api.insertmany (table, rows=(), **kwargs)
 Convenience wrapper for database multiple INSERTs, returns list of inserted row IDs. More...
 
def dblite.api.register_adapter (transformer, typeclasses, engine=None)
 Registers function to auto-adapt given Python types to database types in query parameters. More...
 
def dblite.api.register_converter (transformer, typenames, engine=None)
 Registers function to auto-convert given database types to Python in query results. More...
 
def dblite.api.register_row_factory (row_factory, engine=None)
 Registers function to produce query results as custom type. More...
 
def dblite.api.select (table, cols="*", where=(), group=(), order=(), limit=(), **kwargs)
 Convenience wrapper for database SELECT, returns database cursor. More...
 
def dblite.api.transaction (commit=True, exclusive=None, **kwargs)
 Returns a transaction context manager. More...
 
def dblite.api.update (table, values, where=(), **kwargs)
 Convenience wrapper for database UPDATE, returns affected row count. More...