ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mxm...@apache.org
Subject incubator-ariatosca git commit: added raising for unsupported predicates
Date Wed, 05 Apr 2017 12:55:16 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-137-Support-for-predicate-based-queries-in-the-SQL-mapi 81853bfb1 ->
01cda60df


added raising for unsupported predicates


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/01cda60d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/01cda60d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/01cda60d

Branch: refs/heads/ARIA-137-Support-for-predicate-based-queries-in-the-SQL-mapi
Commit: 01cda60df62acd63acf41fb2a723b2ef25db492a
Parents: 81853bf
Author: max-orlov <maxim@gigaspaces.com>
Authored: Wed Apr 5 15:55:11 2017 +0300
Committer: max-orlov <maxim@gigaspaces.com>
Committed: Wed Apr 5 15:55:11 2017 +0300

----------------------------------------------------------------------
 aria/storage/sql_mapi.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/01cda60d/aria/storage/sql_mapi.py
----------------------------------------------------------------------
diff --git a/aria/storage/sql_mapi.py b/aria/storage/sql_mapi.py
index 59312b8..dca6a5c 100644
--- a/aria/storage/sql_mapi.py
+++ b/aria/storage/sql_mapi.py
@@ -291,9 +291,13 @@ class SQLAlchemyModelAPI(api.ModelAPI):
         for column, conditions in filters.items():
             if isinstance(conditions, dict):
                 for predicate, operand in conditions.items():
-                    if predicate in _predicates:
-                        del filters[column][predicate]
-                        filters[column][_predicates[predicate]] = operand
+                    if predicate not in _predicates:
+                        raise exceptions.StorageError(
+                            "ARIA doesn't support {0} as a valid predicate for filtering.
Valid "
+                            "predicates are {1}".format(predicate, ','.join(_predicates.keys())))
+                    del filters[column][predicate]
+                    filters[column][_predicates[predicate]] = operand
+
 
         return filters
 


Mime
View raw message