postgres doesnt have a unicode column type.  the Unicode SA type is a  
string type with additional python-side processing of the data.

to reflect a table with some columns coming back as Unicode, see the  
metadata docs on "overriding columns".

also you might want to forego the Unicode type altogether and just  
use convert_unicode=True on your create_engine().

On Mar 15, 2007, at 12:57 PM, dvd wrote:

>
> Hi all,
>
> I'm working with postgres and sqlalchemy, I found a strange behavior
> (a bug?) of the reflection code,
> take a look at this:
>
> # ------------------------------------------------------------
> import sqlalchemy as sa
>
> engine = sa.create_engine('postgres://xxx:[EMAIL PROTECTED]/xxx')
> metadata = sa.BoundMetaData(engine)
> tbl1 = sa.Table('test', metadata, sa.Column('test', sa.Unicode(100)))
> print tbl1.c['test'].type, type(tbl1.c['test'].type) is sa.Unicode
> metadata.create_all()
>
> metadata = sa.BoundMetaData(engine)
> tbl2 = sa.Table('test', metadata, autoload=True)
> print tbl2.c['test'].type, type(tbl2.c['test'].type) is sa.Unicode
> # ------------------------------------------------------------
>
> The output of this snippet is
>
> # ---8<-----------------------------------------------------
> Unicode() True
> PGString(length=100) False
> # --->8------------------------------------------------------
>
> The reflection code doesn't recognize the Unicode type, same behavior
> with
>
> engine = sa.create_engine('sqlite:///')
>
> thank you
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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