--- /dev/null
+.. change::
+ :tags: bug, regression, sql
+ :tickets: 5979
+
+ Fixed regression where the "unsupported compilation error" for unknown
+ datatypes would fail to raise correctly.
def process(self, type_, **kw):
return type_._compiler_dispatch(self, **kw)
+ def visit_unsupported_compilation(self, element, err, **kw):
+ util.raise_(
+ exc.UnsupportedCompilationError(self, element),
+ replace_context=err,
+ )
+
# this was a Visitable, but to allow accurate detection of
# column elements this is actually a column element
from sqlalchemy.testing import AssertsCompiledSQL
from sqlalchemy.testing import eq_
from sqlalchemy.testing import eq_ignore_whitespace
+from sqlalchemy.testing import expect_raises_message
from sqlalchemy.testing import fixtures
from sqlalchemy.testing import is_
from sqlalchemy.testing import is_true
go,
)
+ def test_unsupported_type(self):
+ class MyType(types.TypeEngine):
+ __visit_name__ = "mytype"
+
+ t = Table("t", MetaData(), Column("q", MyType()))
+
+ with expect_raises_message(
+ exc.CompileError,
+ r"\(in table 't', column 'q'\): Compiler .*SQLiteTypeCompiler.* "
+ r"can't render element of type MyType\(\)",
+ ):
+ schema.CreateTable(t).compile(dialect=sqlite.dialect())
+
def test_unsupported_operator(self):
from sqlalchemy.sql.expression import BinaryExpression