open-policy-agent / contrib

Integrations, examples, and proof-of-concepts that are not part of OPA proper.

Home Page:http://www.openpolicyagent.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: limited portability due to generated SQL strings in data_filter_example

anadon opened this issue · comments

In the data_filter_example, there is an issue which affects portability between different implementations of SQL. In particular, strings can be single quoted, others double quoted, or either depending upon the implementation. There should be a flag to control which kind of quotation is used.

This can be fixed by modifying the sql() function here: https://github.com/open-policy-agent/contrib/blob/master/data_filter_example/data_filter_example/sql.py#L79

Currently the code JSON serializes constant values so strings get written out with double quotes. Perhaps we could could just special case unicode and str types to print with single quotes.

Fixed by #46