i mean like,
t = Table("sometable", metadata, Column(...))
s = select([t], t.c.somecol==5)
thats constructed SQL.
constructed SQL has some support for literal strings. you should be
able to get away with:
t = text("select * from table", typemap={"col1":String, "col2":Date})
result = engine.execute(t)
and col1/col2 will have type processing done (including the unicode
thing).
On Feb 13, 6:03 pm, "michi" <[EMAIL PROTECTED]> wrote:
> Hi Michael,
>
> Thank you for your response. I have one question:
>
> 1. By constructed SQL, do you mean something like "select * from
> table_name"? If that's the case, I tried it, and it still returns str.
>
> Again, thank you for your quick response,
> --Michi
>
> On Feb 13, 2:44 pm, "Michael Bayer" <[EMAIL PROTECTED]> wrote:
>
> > the result set type processing doesnt take effect for straight textual
> > executions. you have to work with constructed SQL for all that to
> > take effect (or use the text() type with a typemap).
>
> > On Feb 13, 5:31 pm, "michi" <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I'm trying to select string as unicode using postgresql. Here is what
> > > I do:
>
> > > ### begin code>>> db = create_engine("postgres://...",
> > > convert_unicode=True)
> > > >>> con = db.connect()
> > > >>> result = con.execute("select 'a'")
> > > >>> for a in result:
>
> > > ... for attr in a:
> > > ... print type(attr)
> > > ...
> > > <type 'str'>
> > > ### end code
>
> > > Why is the result of type str?
>
> > > Thanks,
> > > --Michi
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---