ah ok, I didn’t know that SQL server lacked Falseness. thanks.
On August 7, 2014 at 11:01:50 AM, Michael Bayer ([email protected]) wrote: On Aug 7, 2014, at 11:34 AM, dweitzenfeld <[email protected]> wrote: \nFROM [MemberFacts] \nWHERE ([MemberFacts].[Rtid] LIKE ? + '%%') = 0) AS anon_1 LEFT OUTER JOIN [AffinionCodes] AS [AffinionCodes_1] ON anon_1.[MemberFacts_Rtid] = [AffinionCodes_1].[Rtid]" ('0000',) It seems to be the " = 0 " that sql server is complaining about. Is this a known issue? Well SQL Server doesn’t have a “False” construct, so the best we can do for “false” is 0 in SQL server, which isn’t going to work in more elaborate situations such as the above. if you want to negate things, just use sqlalchemy.not_() or ~: from sqlalchemy.sql import column from sqlalchemy import String from sqlalchemy.dialects import mssql c = column('x', String) print (~c.startswith("foo")).compile(dialect=mssql.dialect()) classic$ python test.py x NOT LIKE :x_1 + '%%' I've created a silly workaround, by baking the negation in: @hybrid_property def is_not_legacy(self): return self.Rtid[:4] != '0000' @is_not_legacy.expression def is_not_legacy(cls): return cls.Rtid.notlike('0000%') -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to a topic in the Google Groups "sqlalchemy" group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/sqlalchemy/81b7A9eDz9U/unsubscribe. To unsubscribe from this group and all its topics, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
