diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-02-19 00:19:16 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-02-19 00:19:16 +0000 |
commit | f1a68f37fa9aea41d21049307fef840f9b6a0116 (patch) | |
tree | d762e8e262f0ed6d31c689912fdb82dc55771ad1 /lib/sqlalchemy/sql.py | |
parent | 2d5e6eb93b08961d557399899a51dac225832716 (diff) | |
download | sqlalchemy-f1a68f37fa9aea41d21049307fef840f9b6a0116.tar.gz |
exception package added, support throughout
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r-- | lib/sqlalchemy/sql.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index 03c94c5e3..9b3571384 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -6,9 +6,10 @@ """defines the base components of SQL expression trees.""" -import sqlalchemy.schema as schema -import sqlalchemy.util as util -import sqlalchemy.types as sqltypes +import schema +import util +import types as sqltypes +from exceptions import * import string, re, random types = __import__('types') @@ -379,7 +380,7 @@ class ClauseElement(object): engine = self.engine if engine is None: - raise "no SQLEngine could be located within this ClauseElement." + raise InvalidRequestError("no SQLEngine could be located within this ClauseElement.") return engine.compile(self, parameters=parameters, typemap=typemap) @@ -475,7 +476,7 @@ class CompareMixin(object): if _is_literal(obj): if obj is None: if operator != '=': - raise "Only '=' operator can be used with NULL" + raise ArgumentError("Only '=' operator can be used with NULL") return BooleanExpression(self._compare_self(), null(), 'IS') else: obj = self._bind_param(obj) @@ -857,7 +858,7 @@ class Join(FromClause): crit.append(secondary._get_col_by_original(fk.column) == fk.parent) self.foreignkey = fk.parent if len(crit) == 0: - raise "Cant find any foreign key relationships between '%s' (%s) and '%s' (%s)" % (primary.name, repr(primary), secondary.name, repr(secondary)) + raise ArgumentError("Cant find any foreign key relationships between '%s' (%s) and '%s' (%s)" % (primary.name, repr(primary), secondary.name, repr(secondary))) elif len(crit) == 1: return (crit[0]) else: @@ -1043,7 +1044,7 @@ class ColumnImpl(ColumnElement): if engine is None: engine = self.engine if engine is None: - raise "no SQLEngine could be located within this ClauseElement." + raise InvalidRequestError("no SQLEngine could be located within this ClauseElement.") return engine.compile(self.column, parameters=parameters, typemap=typemap) class TableImpl(FromClause): |