--- /dev/null
+.. change::
+ :tags: bug, sql
+ :tickets: 4142
+
+ Changed the "visit name" of :class:`.ColumnElement` from "column" to
+ "column_element", so that when this element is used as the basis for a
+ user-defined SQL element, it is not assumed to behave like a table-bound
+ :class:`.ColumnClause` when processed by various SQL traversal utilities,
+ as are commonly used by the ORM.
-from sqlalchemy.testing import fixtures, is_true, is_false
+from sqlalchemy.testing import fixtures, is_true, is_false, eq_
from sqlalchemy import MetaData, Table, Column, Integer, String
from sqlalchemy import and_, or_, bindparam
-from sqlalchemy.sql.elements import ClauseList
+from sqlalchemy.sql.elements import ClauseList, ColumnElement
from sqlalchemy.sql import operators
+from sqlalchemy.sql import util as sql_util
class CompareClausesTest(fixtures.TestBase):
is_false(b1.compare(b8))
is_false(b8.compare(b9))
is_true(b8.compare(b8))
+
+
+class MiscTest(fixtures.TestBase):
+ def test_column_element_no_visit(self):
+ class MyElement(ColumnElement):
+ pass
+
+ eq_(
+ sql_util.find_tables(MyElement(), check_columns=True),
+ []
+ )