Base classes to wrap various SQL based databases in dffml.db abstraction.
Creates a create query. Table with name table_name will be created
if it doesn’t exist.
Creates insert query. Keys in data dict correspond to the columns in
table_name.
Creates a query string and tuple of parameters used as bindings.
Returns a dict with keys ‘expression’,’values’ if conditions is not empty else returns None
example:
Input : conditions = [
[["firstName", "=", "John"], ["lastName", "=", "Miles"]],
[["age", "<", "38"]],
]
Output : {
'expression':
'((firstName = ? ) OR (lastName = ? )) AND ((age < ? ))',
'values':
['John', 'Miles', '38']
}
Creates a delete query to remove rows from table_name (satisfying
conditions if provided).
table_name (str) – Name of the table.
conditions (Conditions, optional) – Nested array of conditions to satisfy, becomes WHERE.
query (str) – DELETE query
parameters (tuple) – Variables to bind