ensure that a column exists in the table before attempting to filter on it
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Sun, 10 Mar 2013 03:03:28 +0000 (22:03 -0500)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Sun, 10 Mar 2013 03:03:28 +0000 (22:03 -0500)
PLC/Storage/AlchemyObject.py

index ed9eca8..88b505e 100644 (file)
@@ -88,7 +88,9 @@ class AlchemyObj(Record):
         for (field, value) in filter.items():
             if isinstance(value, list):
                 if value:
-                    constraints.append(table.columns.get(field).in_(value))
+                    column = table.columns.get(field)
+                    if isinstance(column, Column): 
+                        constraints.append(column.in_(value))
             else:
                 constraints.append(table.columns.get(field) == value)
         if not constraints: