summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/sql/schema.py')
-rw-r--r--lib/sqlalchemy/sql/schema.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index d9667e445..69fc9408f 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -104,7 +104,15 @@ class SchemaItem(SchemaEventTarget, visitors.Visitable):
for item in args:
if item is not None:
- item._set_parent_with_dispatch(self)
+ try:
+ spwd = item._set_parent_with_dispatch
+ except AttributeError:
+ raise exc.ArgumentError(
+ "'SchemaItem' object, such as a 'Column' or a "
+ "'Constraint' expected, got %r" % item
+ )
+ else:
+ spwd(self)
def get_children(self, **kwargs):
"""used to allow SchemaVisitor access"""