Thanks Michael.
I applied that patch and run that code above, then I got a different
NotSupportedError.

traceback)
-----------------------------------------------------------------
Traceback (most recent call last):
  File "model.py", line 19, in <module>
    emp = Table('emp', metadata, autoload=True)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\schema.py", line 114, in __call__
    metadata._get_bind(raiseerr=True).reflecttable(table,
include_columns=include_columns)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\engine\base.py", line 1178, in reflecttable
    self.dialect.reflecttable(conn, table, include_columns)
  File "C:\Python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\databases\oracle.py", line 524, in reflecttable
    schema.Table(remote_table, table.metadata, autoload=True,
autoload_with=connection, owner=remote_owner)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\schema.py", line 112, in __call__
    autoload_with.reflecttable(table, include_columns=include_columns)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\engine\base.py", line 909, in reflecttable
    return self.__engine.reflecttable(table, self, include_columns)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\engine\base.py", line 1178, in reflecttable
    self.dialect.reflecttable(conn, table, include_columns)
  File "C:\Python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\databases\oracle.py", line 434, in reflecttable
    actual_name, owner, dblink = self._resolve_table_owner(connection,
self._denormalize_name(table.name), table)
  File "C:\Python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\databases\oracle.py", line 377, in _resolve_table_owner
    c = connection.execute ("select distinct OWNER from ALL_TAB_COLUMNS
%(dblink)s where TABLE_NAME = :table_name" % {'dblink':dblink},
{'table_name':name})
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\engine\base.py", line 779, in execute
    return Connection.executors[c](self, object, multiparams, params)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\engine\base.py", line 789, in _execute_text
    self.__execute_raw(context)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\engine\base.py", line 852, in __execute_raw
    self._cursor_execute(context.cursor, context.statement,
context.parameters[0], context=context)
  File "c:\python25\lib\site-packages\sqlalchemy-0.4.0beta6-py2.5.egg
\sqlalchemy\engine\base.py", line 869, in _cursor_execute
    raise exceptions.DBAPIError.instance(statement, parameters, e)
sqlalchemy.exceptions.NotSupportedError: (NotSupportedError)
Variable_TypeByValue(): unhandled data type unicode 'select distinct
OWNER from ALL_TAB_COLUMNS where TABLE_NAME
= :table_name' {'table_name': u'DEPT'}
-----------------------------------------------------------------

I guess this error occured at the second reflection by foreign keys.
So I modified oracle.py to convert 'table_name' from unicode to
string, no error occured and finally I got 'unicode'.
Below is the patch I modified. Could you inspect this?

-----------------------------------------------------------------
--- databases/oracle.py.orig    Fri Oct 05 14:51:18 2007
+++ databases/oracle.py Fri Oct 05 14:48:46 2007
@@ -409,9 +409,14 @@
         if name is None:
             return None
         elif name.upper() == name and not
self.identifier_preparer._requires_quotes(name.lower()):
-            return name.lower()
+            normalized_name = name.lower()
         else:
-            return name
+            normalized_name = name
+
+        if self.convert_unicode:
+            return normalized_name.encode(self.encoding)
+        else:
+            return normalized_name

     def _denormalize_name(self, name):
         if name is None:
-----------------------------------------------------------------

On 10月5日, 午前12:27, Michael Bayer <[EMAIL PROTECTED]> wrote:
> this is ticket #800 in trac, which will be fixed soon.  in the
> meantime, heres a patch you can apply which will fix for now:
>
> http://www.sqlalchemy.org/trac/attachment/ticket/800/patch.diff


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