You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by yo...@apache.org on 2022/01/28 07:04:01 UTC

[superset] 02/10: fix

This is an automated email from the ASF dual-hosted git repository.

yongjiezhao pushed a commit to branch pull/17881
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 486e1e1dc741392b69a5eb541096296ae76ac21e
Author: stephenLYZ <75...@qq.com>
AuthorDate: Sun Jan 2 00:10:03 2022 +0800

    fix
---
 superset/connectors/base/models.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py
index 09aa1c5..85d8edd 100644
--- a/superset/connectors/base/models.py
+++ b/superset/connectors/base/models.py
@@ -15,6 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 import json
+import re
 from datetime import datetime
 from enum import Enum
 from typing import Any, Dict, Hashable, List, Optional, Set, Type, Union
@@ -398,7 +399,11 @@ class BaseDatasource(
             ):
                 return datetime.utcfromtimestamp(value / 1000)
             if isinstance(value, str):
-                value = value.strip("\t\n ")
+                value = value.strip("\t\n")
+
+                quotes_value = re.findall(r"['|\"](.*?)['|\"]", value)
+                if len(quotes_value) == 1 and quotes_value[0] == value.strip("'\""):
+                    value = value.strip("'\"")
 
                 if target_column_type == utils.GenericDataType.NUMERIC:
                     # For backwards compatibility and edge cases