dblite  1.3.0
Simple query interface for SQL databases
dblite.engines.sqlite.Queryable Class Reference
Inheritance diagram for dblite.engines.sqlite.Queryable:
Inheritance graph

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...
 

Detailed Description

Definition at line 47 of file sqlite.py.

Member Function Documentation

◆ insert()

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.

Definition at line 62 of file sqlite.py.

◆ insertmany()

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.

Definition at line 71 of file sqlite.py.

◆ makeSQL()

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.

Definition at line 98 of file sqlite.py.

◆ quote()

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).

Parameters
valuethe value to quote, returned as-is if not string
forcewhether to quote value even if not required

Reimplemented from dblite.api.Queryable.

Definition at line 222 of file sqlite.py.

Member Data Documentation

◆ ENGINE

string dblite.engines.sqlite.Queryable.ENGINE = "sqlite"
static

Name of underlying database engine.

Definition at line 55 of file sqlite.py.

◆ OPS

list dblite.engines.sqlite.Queryable.OPS
static
Initial value:
= ["||", "*", "/", "%", "+", "-", "<<", ">>", "&", "|", "<", "<=", ">",
">=", "=", "==", "!=", "<>", "IS", "IS NOT", "IN", "NOT IN", "LIKE",
"GLOB", "MATCH", "REGEXP", "AND", "OR"]

Recognized binary operators for makeSQL()

Definition at line 50 of file sqlite.py.


The documentation for this class was generated from the following file: