superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ville...@apache.org
Subject [incubator-superset] branch master updated: Remove collation info from MSSQL column type (#7963)
Date Mon, 05 Aug 2019 14:09:07 GMT
This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new b856666  Remove collation info from MSSQL column type (#7963)
b856666 is described below

commit b856666ae221df3a09d5aa5c3c9c83dd5cb5e681
Author: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
AuthorDate: Mon Aug 5 17:08:58 2019 +0300

    Remove collation info from MSSQL column type (#7963)
---
 superset/db_engine_specs/mssql.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/superset/db_engine_specs/mssql.py b/superset/db_engine_specs/mssql.py
index bde1185..1751146 100644
--- a/superset/db_engine_specs/mssql.py
+++ b/superset/db_engine_specs/mssql.py
@@ -66,3 +66,14 @@ class MssqlEngineSpec(BaseEngineSpec):
             if regex.match(type_):
                 return sqla_type
         return None
+
+    @classmethod
+    def column_datatype_to_string(cls, sqla_column_type, dialect):
+        datatype = super().column_datatype_to_string(sqla_column_type, dialect)
+        # MSSQL returns long overflowing datatype
+        # as in 'VARCHAR(255) COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS'
+        # and we don't need the verbose collation type
+        str_cutoff = " COLLATE "
+        if str_cutoff in datatype:
+            datatype = datatype.split(str_cutoff)[0]
+        return datatype


Mime
View raw message