confirmed for pymssql committed in r1a1ef69edef7 . On Nov 15, 2010, at 11:57 AM, Bertrand Janin wrote:
> Hello all, > > Here is what I have: > > table = Table("contract", metadata, > ... > Column("is_awesome", Boolean), > ... > ) > > mapper(Contract, table, properties={ > ... > "is_awesome": table.c.is_awesome, > ... > }) > > When using "mssql+pymssql", if I set the ``is_awesome`` value on a > ``Contract`` instance, I get the following: > > OperationalError: (OperationalError) SQL Server message 207, severity 16, > state 1, line 1: > Invalid column name 'False'. > DB-Lib error message 207, severity 16: General SQL Server error: > Check messages from the SQL Server > 'UPDATE contract SET is_awesome=%(is_awesome)s' > {'is_awesome': False} > > You can find a patch below that converts the ``bool`` to an ``int`` for > dialects not supporting "native_boolean", this fixes the problem for me, > but maybe I'm approaching the issue the wrong way. > > Thanks, > Bertrand > > > diff -r d5ab043dc08f lib/sqlalchemy/types.py > --- a/lib/sqlalchemy/types.py Mon Nov 15 09:55:43 2010 -0500 > +++ b/lib/sqlalchemy/types.py Mon Nov 15 11:42:28 2010 -0500 > @@ -1681,6 +1681,12 @@ > self._should_create_constraint) > ) > table.append_constraint(e) > + > + def bind_processor(self, dialect): > + if dialect.supports_native_boolean: > + return None > + else: > + return lambda b: int(b) > > def result_processor(self, dialect, coltype): > if dialect.supports_native_boolean: > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.