[Sqlalchemy-tickets] [sqlalchemy] #2748: reflecttable not checking for None exclude_columns
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-06-07 11:47:06
|
#2748: reflecttable not checking for None exclude_columns
-------------------------+-----------------------------------------
Reporter: rstuart4133 | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: cextensions | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-------------------------+-----------------------------------------
This code in reflection.py:reflecttable():
{{{
if pk_cons:
pk_cols = [table.c[pk]
for pk in pk_cons['constrained_columns']
if pk in table.c and pk not in exclude_columns
] + [pk for pk in table.primary_key if pk.key in
exclude_columns]
}}}
Should check if exclude_columns is None. All the previous references to
exclude_columns do, and it turns out it is necessary:
{{{
>>> conn.engine.reflecttable(est)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <lambda>
File "/usr/lib/python2.7/dist-packages/sqlalchemy/util/deprecations.py",
line 100, in warned
return fn(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line
2533, in reflecttable
self.dialect.reflecttable(conn, table, include_columns)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/default.py",
line 260, in reflecttable
return insp.reflecttable(table, include_columns, exclude_columns)
File "/usr/lib/python2.7/dist-packages/sqlalchemy/engine/reflection.py",
line 419, in reflecttable
if pk in table.c and pk not in exclude_columns
TypeError: argument of type 'NoneType' is not iterable
>>>
}}}
This was in version 0.7.8, but the same problem exists in github master.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2748>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|