Takes a string and a dictionary and interpolates the string using values from the dictionary. Returns an `SQLQuery` for the result. >>> reparam("s = $s", dict(s=True)) >>> reparam("s IN $s", dict(s=[1, 2]))
(string_, dictionary)
| 341 | |
| 342 | |
| 343 | def reparam(string_, dictionary): |
| 344 | """ |
| 345 | Takes a string and a dictionary and interpolates the string |
| 346 | using values from the dictionary. Returns an `SQLQuery` for the result. |
| 347 | |
| 348 | >>> reparam("s = $s", dict(s=True)) |
| 349 | <sql: "s = 't'"> |
| 350 | >>> reparam("s IN $s", dict(s=[1, 2])) |
| 351 | <sql: 's IN (1, 2)'> |
| 352 | """ |
| 353 | return SafeEval().safeeval(string_, dictionary) |
| 354 | |
| 355 | |
| 356 | def sqlify(obj): |
no test coverage detected