Re: [Sqlalchemy-tickets] [sqlalchemy] #2823: Wrong sqlalchemy.sql.expression.false() / true() compi
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-09-16 22:07:36
|
#2823: Wrong sqlalchemy.sql.expression.false() / true() compilation when using SQL
Server dialect
-------------------------------------------+-------------------------------
Reporter: leavittx | Owner:
Type: defect | Status: new
Priority: medium | Milestone:
Component: mssql | Severity: no triage
Resolution: | selected yet
Progress State: needs questions answered | Keywords:
-------------------------------------------+-------------------------------
Comment (by leavittx):
I'd not use such expressions at all, but that's the filter code which
sqlalchemy-orm-tree extension produces (https://github.com/monetizeio
/sqlalchemy-orm-tree). So I see two possible solutions for the problem
with true()/false() in isolation of a comparison. The first one is to
generate hacky constructions like you said (I don't think they will slow
the things so much). The second one is to do expression analysys &
simplifying in some cases (i.e. 'false OR someexpr' becomes 'someexpr',
'true AND someexpr' becomes 'someexpr' too, 'true OR someexpr' becomes
'1=1 or someexpr', 'false AND someexpr' becomes '1=0'). I think the
current behavior (generation of invalid sql code for sql server) is
unacceptable!
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2823#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|