- changed status to invalid
table.count() doesnt work on mysql (and maybe others)
Issue #576
resolved
the 'tbl_row_count' alias doesnt get picked up correctly in the WHERE:
from sqlalchemy import *
e = create_engine('mysql://scott:tiger@localhost/test')
m = MetaData()
t = Table('test', m, Column('data', String(30)))
m.create_all(e)
c1 = e.connect()
assert c1.scalar(t.count(t.c.data=='data')) == 0
Traceback (most recent call last):
File "tisolation.py", line 11, in ?
assert c1.scalar(t.count(t.c.data=='test1')) == 0
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/sqlalchemy/engine/base.py", line 504, in scalar
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/sqlalchemy/engine/base.py", line 512, in execute
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/sqlalchemy/engine/base.py", line 552, in execute_clauseelement
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/sqlalchemy/engine/base.py", line 563, in execute_compiled
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/sqlalchemy/engine/base.py", line 576, in _execute_raw
File "build/bdist.darwin-8.9.0-Power_Macintosh/egg/sqlalchemy/engine/base.py", line 594, in _execute
sqlalchemy.exceptions.SQLError: (OperationalError) (1054, "Unknown column 'test.data' in 'field list'") u'SELECT count(test.data) AS tbl_row_count \nFROM test \nWHERE test.data = %s' ['test1']('test1')
Comments (2)
-
reporter -
reporter - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment
der, my mistake, nm