-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Can't do xxx.in_([None])
with MSSQLStrictCompiler
#2496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Michael Bayer (@zzzeek) wrote: There is absolutely no reason you need the MSSQLStrictCompiler with pyodbc, it was designed for mxodbc which uses a particular API of ODBC that allows binds in far fewer places. The bug here is that in_() is not expecting "None" at all, which would normally be coerced to null(). Workaround is to, well first off don't bother with the "strict" compiler, no idea what purpose that is solving, then for now just pass null() instead of None.
patch:
|
Changes by Michael Bayer (@zzzeek):
|
Sok Ann Yap (@sayap) wrote: Well, I kind of abuse column_property, resulting in queries with 100+ bind parameters in the columns clause, which makes SQL Server Profiler output rather difficult to read. So using the strict compiler is more of a cosmetic fix for something I regret doing but too late to be changed. Patch works. Thanks :) |
Sok Ann Yap (@sayap) wrote: On further thought, setting ansi_bind_rules to True looks like a more fitting workaround for me, as I do want to have IN clause and NOT IN clause to be parameterized. |
Changes by Michael Bayer (@zzzeek):
|
Migrated issue, originally created by Sok Ann Yap (@sayap)
With MSSQLStrictCompiler, adding a
xxx.in_([None](None))
filter to a query will cause error:The text was updated successfully, but these errors were encountered: