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

Go to the source code of this file.

Classes

class  dblite.util.StaticTzInfo
 datetime.tzinfo class representing a constant offset from UTC. More...
 

Namespaces

 dblite.util
 

Functions

def dblite.util.factory (ctor, data)
 Returns object constructed with data dictionary. More...
 
def dblite.util.is_dataobject (obj)
 Returns whether input is a data object: namedtuple, or has attributes or slots. More...
 
def dblite.util.is_namedtuple (obj)
 Returns whether input is a namedtuple class or instance. More...
 
def dblite.util.json_dumps (data, indent=2, sort_keys=True)
 Returns JSON string, with datetime types converted to ISO-8601 strings (in UTC if no timezone set), sets converted to lists, and Decimal objects converted to float or int. More...
 
def dblite.util.json_loads (s)
 Returns deserialized JSON, with datetime/date strings converted to objects. More...
 
def dblite.util.keyvalues (obj, namefmt=None)
 Returns a list of keys and values, or [given object] if not applicable. More...
 
def dblite.util.load_modules ()
 Returns db engines loaded from file directory, as {name: module}. More...
 
def dblite.util.nameify (val, namefmt=None, parent=None)
 Returns value as table or column name string. More...
 
def dblite.util.parse_datetime (s)
 Tries to parse string as ISO8601 datetime, returns input on error. More...
 

Variables

 dblite.util.UTC = StaticTzInfo("UTC", StaticTzInfo.ZERO)
 UTC timezone singleton. More...