Ivo wrote:
>
> When working with Oracle, we use the `convert_unicode` parameter, and
> use Python unicode objects everywhere. This works fabulously, and we
> even set `assert_unicode` to 'error' to make sure that nothing else is
> ever used.
> However, when reflecting a table using the `autoload` keyword, these
> properties are not set on the resulting columns. This leads to
> interesting errors such as:
>
> sqlalchemy.exc.NotSupportedError: (NotSupportedError)
> Variable_TypeByValue(): unhandled data type unicode 'INSERT INTO
> testtable5 (id, b) VALUES (:id, :b)' {'b': u'test', 'id': None}
>
> Is there a way to instrument the columns by telling the autoload
> mechanism that I would like to use `convert_unicode` for the columns
> where it makes sense, or by modifying the reflected columns after the
> table has been loaded?
if convert_unicode and assert_unicode are set on create_engine(), then all
String types will have the Unicode behavior. As far as changing the
column type that comes back for a certain reflected type on an automated
basis, you'd have to change the "ischema_names" dictionary accordingly in
the Oracle dialect, or post process your Table objects to switch all the
"String" types to "Unicode", but in general this should not be needed. We
haven't created an official "feature" for this as of yet.
Also note however that Oracle's NVARCHAR2 type does reflect already to a
unicode-subclass. Ideally you'd be using NVARCHAR2 for
unicode-containing values (works better with cx_oracle as cx_oracle
recognizes them automatically as unicode).
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---