Hi,
I have a strange behavior (well, a blocking issue) on both sqlite and
mssql with unicode strings. It inserting a empty unicode string, it's
not encoded before being sent, while a non-empty string get encoded
correctly.
With sqlite it's not a problem, but with mssql it leads to a "Invalid
data type (0)"
The following program illustrate it :
from sqlalchemy import *
e = create_engine("sqlite:///", echo=True)
m = MetaData(e)
t = Table("test", m,
Column('test', String(convert_unicode=True)))
t.create()
m.bind.execute(t.insert(), dict(test=u'hello'))
m.bind.execute(t.insert(), dict(test=u''))
Running it output this :
2007-08-16 19:21:22,624 INFO sqlalchemy.engine.base.Engine.0x..34
CREATE TABLE test (
test TEXT
)
2007-08-16 19:21:22,625 INFO sqlalchemy.engine.base.Engine.0x..34 None
2007-08-16 19:21:22,626 INFO sqlalchemy.engine.base.Engine.0x..34 COMMIT
2007-08-16 19:21:22,628 INFO sqlalchemy.engine.base.Engine.0x..34
INSERT INTO test (test) VALUES (?)
2007-08-16 19:21:22,629 INFO sqlalchemy.engine.base.Engine.0x..34 ['hello']
2007-08-16 19:21:22,629 INFO sqlalchemy.engine.base.Engine.0x..34 COMMIT
2007-08-16 19:21:22,631 INFO sqlalchemy.engine.base.Engine.0x..34
INSERT INTO test (test) VALUES (?)
2007-08-16 19:21:22,632 INFO sqlalchemy.engine.base.Engine.0x..34 [u'']
2007-08-16 19:21:22,632 INFO sqlalchemy.engine.base.Engine.0x..34 COMMIT
I had a quick look at the code and I cannot see anything leading to
this behavior.
Any idea ?
Regards,
Christophe
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---