- attached diff_sql.patch
ColumnCollection doesn't follow dictionary semantics
Everytime you try something like:
t = model.metadata.tables'test' print 'name' in t.c
ALWAYS returns false. The error was in the contains method of the sql.ColumnCollection class. A patch is attached, showing the code difference.
The file is lib/sqlalchemy/sql.py
Nicholas Amorim
Comments (8)
-
Account Deleted -
Account Deleted my email:
nicholasamorim@gmail.com
-
repo owner - changed milestone to 0.4.0
- changed title to ColumnCollection doesn't follow dictionary semantics
OK...actually, thats not the point of the
__contains__()
method at the moment. it wasnt intended to be used with strings, its intended to be used with Column objects. thats why the 3 line comment and Set is there, although Column should probably implement hash() and cmp() to eliminate the need for that (eq() already is modified in such a way as to not work for dictionaries).however since the ColumnCollection is acting like a dict, the contains should be decoupled from the contains_column() method and all the relevant ORM code changed to not use "in" (hence a "major" change).
-
Account Deleted Even actiing like a dict, why not support "in" ?
A normal dict supports it with keys.
foo = {"bar" : "test"} "bar" in foo True
-
repo owner yes, thats the point of the ticket, which is still open until this change is made. the current internal usage of "in" on this object is in conflict with dictionary semantics.
-
repo owner - marked as critical
-
repo owner - changed status to resolved
-
repo owner - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment
Patch