Anybody?

On Jun 4, 1:13 am, AF <allen.fow...@yahoo.com> wrote:
> Hello,
>
> I'm using sqlite and "convert_unicode = True "on the engine.
>
> How can I force coerce string based object attributes in to unicode?
> (I had thought "convert_unicode = True" would do this)
>
> Here is what I am seeing...
>
> Setup code:
> engine = create_engine('sqlite:///:memory:', echo=True,
> convert_unicode=True)
> Session = sessionmaker(bind=engine)
> session = Session()
> metadata = MetaData()
> m1 = message(u'message body 1')
>
> Now, in ipython:
>
> In [1]: session.add(m1)
>
> In [2]: m1.body
> Out[2]: u'message body 1'
>
> In [3]: m1.body = u'new - unicode'
>
> In [4]: m1.body
> Out[4]: u'new - unicode'
>
> In [5]: m1.body = 'new - NOT unicode'
>
> In [6]: m1.body
> Out[6]: 'new - NOT unicode'
>
> In [7]: unicode(m1.body)
> Out[7]: u'new - NOT unicode'
>
> Output line 6 is the problem.
>
> Ideally, I'd like to see output lines 6 & 7 be the same.
>
> Am I doing something wrong?
>
> Thank you,
> Allen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to