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.
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.