where¶
-
BaseQueryBuilder.
where
(col, val, compare='=', placeholder=None)[source]¶ For adding a simple col=value clause with “AND” before it (if at least 1 other clause). val is escaped properly
example: where(‘x’,’test’).where(‘y’,’thing’) produces prepared sql “WHERE x = %s AND y = %s”
- Parameters
col – the column, function etc. to query
val – the value it should be equal to. most python objects will be converted and escaped properly
compare – instead of ‘=’, compare using this comparator, e.g. ‘>’, ‘<=’ etc.
placeholder – Set the value placeholder, e.g. placeholder=’HOST(%s)’
- Returns
QueryBuilder object (for chaining)