summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2020-08-14 00:08:29 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2020-08-14 00:08:29 +0000
commit9ccf4a2f659d77c7f1aacaa4ff2b3b16889fea5e (patch)
treec30594326d1fb4b70b239c0865f1b7e627e63cc3 /lib/sqlalchemy/sql
parentb1c3c40e54bafe686065827d5b8d92c35bc50648 (diff)
parent5fb0138a3220161703e6ab1087319a669d14e7f4 (diff)
downloadsqlalchemy-9ccf4a2f659d77c7f1aacaa4ff2b3b16889fea5e.tar.gz
Merge "Implement rudimentary asyncio support w/ asyncpg"
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/__init__.py1
-rw-r--r--lib/sqlalchemy/sql/sqltypes.py20
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/__init__.py b/lib/sqlalchemy/sql/__init__.py
index 2fe6f35d2..8f6dc8e72 100644
--- a/lib/sqlalchemy/sql/__init__.py
+++ b/lib/sqlalchemy/sql/__init__.py
@@ -5,6 +5,7 @@
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
+from .base import Executable # noqa
from .compiler import COLLECT_CARTESIAN_PRODUCTS # noqa
from .compiler import FROM_LINTING # noqa
from .compiler import NO_LINTING # noqa
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py
index 186f885d8..64663a6b0 100644
--- a/lib/sqlalchemy/sql/sqltypes.py
+++ b/lib/sqlalchemy/sql/sqltypes.py
@@ -2316,6 +2316,22 @@ class JSON(Indexable, TypeEngine):
"""
+ class JSONIntIndexType(JSONIndexType):
+ """Placeholder for the datatype of a JSON index value.
+
+ This allows execution-time processing of JSON index values
+ for special syntaxes.
+
+ """
+
+ class JSONStrIndexType(JSONIndexType):
+ """Placeholder for the datatype of a JSON index value.
+
+ This allows execution-time processing of JSON index values
+ for special syntaxes.
+
+ """
+
class JSONPathType(JSONElementType):
"""Placeholder type for JSON path operations.
@@ -2346,7 +2362,9 @@ class JSON(Indexable, TypeEngine):
index,
expr=self.expr,
operator=operators.json_getitem_op,
- bindparam_type=JSON.JSONIndexType,
+ bindparam_type=JSON.JSONIntIndexType
+ if isinstance(index, int)
+ else JSON.JSONStrIndexType,
)
operator = operators.json_getitem_op