summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/compiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/ext/compiler.py')
-rw-r--r--lib/sqlalchemy/ext/compiler.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/compiler.py b/lib/sqlalchemy/ext/compiler.py
index cb126c374..daa9e1551 100644
--- a/lib/sqlalchemy/ext/compiler.py
+++ b/lib/sqlalchemy/ext/compiler.py
@@ -367,6 +367,7 @@ Example usage::
)
"""
+from sqlalchemy import exc
def compiles(class_, *specs):
def decorate(fn):
@@ -399,6 +400,11 @@ class _dispatcher(object):
# TODO: yes, this could also switch off of DBAPI in use.
fn = self.specs.get(compiler.dialect.name, None)
if not fn:
- fn = self.specs['default']
+ try:
+ fn = self.specs['default']
+ except KeyError:
+ raise exc.CompileError(
+ "%s construct has no default "
+ "compilation handler." % type(element))
return fn(element, compiler, **kw)