Hello,

using SQLAlchemy 0.7.3's Inspector, I'm reflecting the columns of a table, 
and it fails with this trace:

  File "./main.py", line 106, in <module>
    dbmgr.reflect()
  File "./main.py", line 32, in reflect
    self.fetch_tables(schema='eg')
  File "./main.py", line 58, in fetch_tables
    cols0 = self.inspector.get_columns(t, schema=schema)
  File 
"/home/dm/myprojects/Runcible-env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-linux-x86_64.egg/sqlalchemy/engine/reflection.py",
 
line 230, in get_columns
    **kw)
  File "<string>", line 1, in <lambda>
  File 
"/home/dm/myprojects/Runcible-env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-linux-x86_64.egg/sqlalchemy/engine/reflection.py",
 
line 46, in cache
    ret = fn(self, con, *args, **kw)
  File 
"/home/dm/myprojects/Runcible-env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-linux-x86_64.egg/sqlalchemy/dialects/postgresql/base.py",
 
line 1191, in get_columns
    rows = c.fetchall()
  File 
"/home/dm/myprojects/Runcible-env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py",
 
line 2985, in fetchall
    l = self.process_rows(self._fetchall_impl())
  File 
"/home/dm/myprojects/Runcible-env/lib/python2.7/site-packages/SQLAlchemy-0.7.3-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py",
 
line 2952, in _fetchall_impl
    return self.cursor.fetchall()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: 
ordinal not in range(128)

I have pinned down the cause to be a column's default value which contains 
a "ü" character (u umlaut). The query SA emits to get the columns should 
give for that column:
     attname     |         format_type         |                    default 
                    | attnotnull | attnum | table_oid 
-----------------+-----------------------------+------------------------------------------------+------------+--------+-----------
 min_amount_unit | character varying(16)       | 'Stück'::character varying 
                    | t          |     10 |     43091

Running the query from psql prompt, or from a simple script that uses 
psycopg2 directly, gives no error. So the problem is SA-related.
(The database's encoding is SQLASCII.)

Is there a fix or workaround for this?

Thanks in advance,
- Dirk

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/GqvhwQSOXLgJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to