dblite  1.3.0
Simple query interface for SQL databases
dblite.engines.postgres.Queryable Class Reference
Inheritance diagram for dblite.engines.postgres.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 = "postgres"
 Name of underlying database engine. More...
 
tuple 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 70 of file postgres.py.

Member Function Documentation

◆ insert()

def dblite.engines.postgres.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 86 of file postgres.py.

◆ insertmany()

def dblite.engines.postgres.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 97 of file postgres.py.

◆ makeSQL()

def dblite.engines.postgres.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 134 of file postgres.py.

◆ quote()

def dblite.engines.postgres.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 269 of file postgres.py.

Member Data Documentation

◆ ENGINE

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

Name of underlying database engine.

Definition at line 79 of file postgres.py.

◆ OPS

tuple dblite.engines.postgres.Queryable.OPS
static
Initial value:
= ("!=", "!~", "!~*", "#", "%", "&", "*", "+", "-", "/", "<", "<<",
"<=", "<>", "<@", "=", ">", ">=", ">>", "@>", "^", "|", "||", "&&", "~",
"~*", "ANY", "ILIKE", "IN", "IS", "IS NOT", "LIKE", "NOT ILIKE", "NOT IN",
"NOT LIKE", "NOT SIMILAR TO", "OR", "OVERLAPS", "SIMILAR TO", "SOME")

Recognized binary operators for makeSQL()

Definition at line 73 of file postgres.py.


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