pysqlite always returns Python unicode objects and this is outside of the
realm of SQLAlchemy.   I'm not familiar with a pysqlite option to change
this but you should consult their site for any options related to it.

Harish Vishwanath wrote:
> Hello All,
>
> I am using Elixir 0.6.1 over SQLA 0.5rc2. Consider the below :
>
>>>> from elixir import *
>>>> class A(Entity):
> *...     name = Field(String(40))*
> ...
>>>> class B(A):
> *...     address = Field(String(40))*
> ...
>>>> engine = "sqlite:///c:\\temp\\2.sqlite"
>>>> metadata.bind = engine
>>>> setup_all(True)
>>>> a = A(name="A")
>>>> type(a.name)
> <type 'str'>
>>>> b = B(name="B",address="B'sAddress")
>>>> type(b.name)
> <type 'str'>
>>>> type(b.address)
> <type 'str'>
>>>> type(a.row_type)
> <type 'NoneType'>
>>>> session.flush()
>>>> session.commit()
> *>>> d = session.query(A)[0]
>>>> d.name
> u'A'
>>>> type(d.name)
> <type 'unicode'>
>>>> d.row_type
> u'a'
> *>>> from elixir import options
> *>>> options.DEFAULT_POLYMORPHIC_COL_NAME
> 'row_type'
>>>> options.POLYMORPHIC_COL_TYPE
> String(length=40, convert_unicode=False, assert_unicode=None)
>>>> options.POLYMORPHIC_COL_SIZE
> 40*
>
> Though I declare fields of Class A and B as strings, when I retrieve the
> objects back from database, the are automatically getting converted to
> Unicode. Also, the default polymorphic column type is String, but row_type
> after retrieval is coming back as unicode. When I query SQLite, I see
> normal
> strings :
>
> sqlite> select * from __main___a;
> 1|A|a|
> 2|B|b|B'sAddress
>
> I donot want my strings to get converted to Unicode, since I am having
> issues with marshalling and transmitting unicode objects over the network.
> Is there any option I am missing? Kindly let me know.
>
>
> --
> Regards,
> Harish
>
> >
>


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to