You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by vi...@apache.org on 2020/09/05 19:36:21 UTC
[incubator-superset] 23/26: fix(db-engine-spec): execute oracle DML
statement bug in sqllab (#10706)
This is an automated email from the ASF dual-hosted git repository.
villebro pushed a commit to branch 0.37
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit ce00c3db4f60a21df6dfd0f6079b146057a26bc1
Author: chuancy <31...@qq.com>
AuthorDate: Mon Aug 31 13:03:07 2020 +0800
fix(db-engine-spec): execute oracle DML statement bug in sqllab (#10706)
* fix execute oracle DML statement bug in sqllab
when i execute oracle sql statements like update in SQLLAB, get "oracle error: not a query" error.
Refer https://www.python.org/dev/peps/pep-0249/, superset old version use
`cursor.description` ,because this attribute will be None for operations that do not return rows or if the cursor has not had an operation invoked via the .execute*() method yet.
* Apply suggestions from code review
Co-authored-by: Ville Brofeldt <33...@users.noreply.github.com>
* Update oracle.py
* Update oracle.py
* Update oracle.py
* Apply suggestions from code review
Co-authored-by: Ville Brofeldt <33...@users.noreply.github.com>
* Update oracle.py
* Update superset/db_engine_specs/oracle.py
Co-authored-by: Ville Brofeldt <33...@users.noreply.github.com>
Co-authored-by: Ville Brofeldt <33...@users.noreply.github.com>
---
superset/db_engine_specs/oracle.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/superset/db_engine_specs/oracle.py b/superset/db_engine_specs/oracle.py
index 813b150..01c06f4 100644
--- a/superset/db_engine_specs/oracle.py
+++ b/superset/db_engine_specs/oracle.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
from datetime import datetime
-from typing import Optional
+from typing import Any, List, Optional, Tuple
from superset.db_engine_specs.base import BaseEngineSpec, LimitMethod
from superset.utils import core as utils
@@ -57,3 +57,16 @@ class OracleEngineSpec(BaseEngineSpec):
@classmethod
def epoch_ms_to_dttm(cls) -> str:
return "TO_DATE('1970-01-01','YYYY-MM-DD')+(1/24/60/60/1000)*{col}"
+
+ @classmethod
+ def fetch_data(
+ cls, cursor: Any, limit: Optional[int] = None
+ ) -> List[Tuple[Any, ...]]:
+ """
+ :param cursor: Cursor instance
+ :param limit: Maximum number of rows to be returned by the cursor
+ :return: Result of query
+ """
+ if not cursor.description:
+ return []
+ return super().fetch_data(cursor, limit)