[Sqlalchemy-tickets] Issue #4280: constant enum values fails with mysql driver (zzzeek/sqlalchemy)
Brought to you by:
zzzeek
From: VA <iss...@bi...> - 2018-06-18 21:47:08
|
New issue 4280: constant enum values fails with mysql driver https://bitbucket.org/zzzeek/sqlalchemy/issues/4280/constant-enum-values-fails-with-mysql VA: I have a table with an Integer column. When filtering on this column using a Python int value, I only get rows matching the integer, which is expected. However, if I filter on the same column with an IntEnum value, I do not get any rows at all when using the mysql driver. It works properly using the sqlite driver though. Attached is a sample source file creating a basic table and doing basic filters. Switching between the 2 drivers is a matter of commenting one line, yet the behavior is completely different. Here are excerpts from the attached file: * A working line with both drivers: ``` #!python print(session.query(Simple).filter(Simple.stuff == 1).all()) ``` * Line not working with mysql: ``` #!python print(session.query(Simple).filter(Simple.stuff == My.a).all()) ``` When using mysql, I get this warning: ``` #!python /usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py:508: Warning: (1292L, "Truncated incorrect DOUBLE value: 'My.a'") ``` So it seems the mysql driver is attempting stringification of a value which is an int (IntEnum inherits int) and fails. |