the internal location where TypeEngine types that were known before
cursor.description was fetched is result.context.result_map. this
only applies to SQL expression constructs though. In the case of
connection.execute("some string"), we dont know anything about the
types except for what's in cursor.description.
On Dec 31, 2008, at 4:00 PM, Dusty Phillips wrote:
>
> Hi there,
>
> I've been searching all over for a solution to this and have concluded
> that I must be doing it all wrong.
>
> I need to create a simple view of an arbitrary sql query result that
> includes the column names and types as a string (eg: integer, varchar,
> etc) as well as a summary of the row data. The problem is, I can't
> find the column type anywhere in the results!
>
> I thought the column type information would be in ResultProxy.context
> somewhere, but I can't find it. I also looked at the RowProxy, but it
> seems to only contain column names and values for each row.
>
> The closest I've come is to use ResultProxy.cursor.cursor.description,
> which gives me a numeric identifier for the column type. The
> documentation seems to indicate that I can then use
> engine.dialect.dbapi_type_map to look up the type of the object.
> Unfortunately, this dictionary is empty, at least for postgres. I'm
> using sqlalchemy 0.5rc4, and it seems as though the type lookups may
> have changed since 0.4, but I can't figure out how its supposed to be
> done now.
>
> Thanks for any insight,
> Dusty
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---