I am using sqlalchemy core to build a query that includes json_extract/json_value
function.
sa.func.json_value(table.c['json_field'], '$.attr')
SQLAlchemy is incorrectly adding the N
prefix to the 'value' in the json_value
WHERE json_value(table.json_field, N'$.attr') = N'value'
This is raising the following error with SQLServer
sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]JSON text is not properly formatted. Unexpected character 'n' is found at position 0. (13609) (SQLExecDirectW)")
How do I tell SQLAlchemy to not add N
to that function argument? Like
WHERE json_value(table.json_field, '$.attr') = N'value'