diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-03 22:12:07 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-01-03 22:12:07 -0500 |
| commit | 729519a9bd8994f7b4e726d6551975e8faf6ca60 (patch) | |
| tree | fe4966baa2255f945121072590bac05df06e26f8 /lib/sqlalchemy/dialects/postgresql/hstore.py | |
| parent | 3f6e62f9dbd98abbff5c611cada45805f6fd0f6e (diff) | |
| download | sqlalchemy-729519a9bd8994f7b4e726d6551975e8faf6ca60.tar.gz | |
- add a layer of dispatch to "custom_op" so that we can again
have custom ops that also have per-dialect compilations styles.
re-establish specific getitem variants for hstore, json, astext, jsonpath,
etc. so that we can remove the isinstance() checks and re-simplify.
there's again a json-specific getitem operator using the new custom_op variety,
though if we move this to the base types we might be able to move
back to not having special visits for custom_op and just having
a new json_getitem operator.
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/hstore.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/hstore.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/hstore.py b/lib/sqlalchemy/dialects/postgresql/hstore.py index 03d8017db..d2d20386a 100644 --- a/lib/sqlalchemy/dialects/postgresql/hstore.py +++ b/lib/sqlalchemy/dialects/postgresql/hstore.py @@ -12,14 +12,13 @@ from .array import ARRAY from ... import types as sqltypes from ...sql import functions as sqlfunc from ...sql import operators -from ...sql.operators import custom_op from ... import util __all__ = ('HSTORE', 'hstore') -INDEX = custom_op( - None, precedence=15, natural_self_precedent=True +GETITEM = operators.custom_op( + "->", precedence=15, natural_self_precedent=True, ) HAS_KEY = operators.custom_op( @@ -166,7 +165,7 @@ class HSTORE(sqltypes.Indexable, sqltypes.Concatenable, sqltypes.TypeEngine): CONTAINED_BY, other, result_type=sqltypes.Boolean) def _setup_getitem(self, index): - return index, self.type.text_type + return GETITEM, index, self.type.text_type def defined(self, key): """Boolean expression. Test for presence of a non-NULL value for |
