summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-03-24 19:51:37 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-03-24 19:51:37 +0000
commite817d1415d825bcf8c8f33927baaf56cd5d07b95 (patch)
tree2b05801095c68a34f662adcc1285c0fdb3f2d07a /lib/sqlalchemy/sql
parent8988d73cc37b0c1f8858228acd398a6c3774811b (diff)
parent7f863344b96c945c56791d31b15a302c2ddd800f (diff)
downloadsqlalchemy-e817d1415d825bcf8c8f33927baaf56cd5d07b95.tar.gz
Merge "Improve the method ``__str__`` of :class:`ColumnCollection`"
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/base.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/sql/base.py b/lib/sqlalchemy/sql/base.py
index 77222706a..f093cad90 100644
--- a/lib/sqlalchemy/sql/base.py
+++ b/lib/sqlalchemy/sql/base.py
@@ -676,7 +676,7 @@ class ColumnCollection(object):
>>> from sqlalchemy import Column, Integer
>>> from sqlalchemy.sql import ColumnCollection
>>> x, y = Column('x', Integer), Column('y', Integer)
- >>> cc = ColumnCollection(columns=[x, y])
+ >>> cc = ColumnCollection(columns=[(x.name, x), (y.name, y)])
>>> cc.x
Column('x', Integer(), table=None)
>>> cc.y
@@ -707,7 +707,7 @@ class ColumnCollection(object):
returned by key access is **arbitrary**::
>>> x1, x2 = Column('x', Integer), Column('x', Integer)
- >>> cc = ColumnCollection(columns=[x1, x2])
+ >>> cc = ColumnCollection(columns=[(x1.name, x1), (x2.name, x2)])
>>> list(cc)
[Column('x', Integer(), table=None),
Column('x', Integer(), table=None)]
@@ -808,7 +808,10 @@ class ColumnCollection(object):
return default
def __str__(self):
- return repr([str(c) for c in self])
+ return "%s(%s)" % (
+ self.__class__.__name__,
+ ", ".join(str(c) for c in self),
+ )
def __setitem__(self, key, value):
raise NotImplementedError()