dssg / collate

Aggregation SQL Query Builder
Other
1 stars 3 forks source link

Allow override of choice quoting in Compare #81

Closed thcrock closed 7 years ago

thcrock commented 7 years ago

It would be useful to control choice quoting more granularly; for instance, to make a categorical that operates on an array column using infix notation, you must use Compare with choices that look like this:

array['{}'::varchar].format(choice)

You don't want these to be quoted, and the maybe_quote function will fail this because it is a string.

One option is to give Compare a quote_choices kwarg which overrides the smart quoting.

Another option, that would use the type-aware pattern common within collate, would be to let the caller pass SQLalchemy literals as choices, and to forgo quoting in that case.