Firebird treats the word 'count' as a keyword, so

mapper / testcount does this:

        mapper(User, users)
        q = create_session().query(User)
        self.assert_(q.count()==3)
        self.assert_(q.count(users.c.user_id.in_(8,9))==2)
        self.assert_(q.count_by(user_name='fred')==1)


which produces:

SQL error code = -104\n  Token unknown - line 1, column 20\n  count') 
'SELECT count(?) AS count \nFROM users' [1]


Is it safe to change sql.py/ FromClause and TableClause count() to use a 
different label than "count"?

Since in this case, the count method is returning it's value, the actual label 
used 
doesn't seem to matter.

Also, Firebird only allows 

count(*)

or

count(column_ref)

So I am not sure how

func.count(1) 

is supposed to be handled.

Where in the engine do I override the handling of count? I couldn't trace much 
beyond sql.FunctionGenerator.

Somehow the engine needs a crack at changing  count.. 


-- 
Brad Clements,                [EMAIL PROTECTED]    (315)268-1000
http://www.murkworks.com                          
AOL-IM or SKYPE: BKClements




-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to