ktmud commented on a change in pull request #13294:
URL: https://github.com/apache/superset/pull/13294#discussion_r586005878



##########
File path: superset/db_engine_specs/presto.py
##########
@@ -356,31 +356,89 @@ def _show_columns(
         return columns
 
     column_type_mappings = (
-        (re.compile(r"^boolean.*", re.IGNORECASE), types.Boolean()),
-        (re.compile(r"^tinyint.*", re.IGNORECASE), TinyInteger()),
-        (re.compile(r"^smallint.*", re.IGNORECASE), types.SmallInteger()),
-        (re.compile(r"^integer.*", re.IGNORECASE), types.Integer()),
-        (re.compile(r"^bigint.*", re.IGNORECASE), types.BigInteger()),
-        (re.compile(r"^real.*", re.IGNORECASE), types.Float()),
-        (re.compile(r"^double.*", re.IGNORECASE), types.Float()),
-        (re.compile(r"^decimal.*", re.IGNORECASE), types.DECIMAL()),
+        (
+            re.compile(r"^boolean.*", re.IGNORECASE),
+            types.Boolean(),
+            utils.GenericDataType.BOOLEAN,
+        ),
+        (
+            re.compile(r"^tinyint.*", re.IGNORECASE),
+            TinyInteger(),
+            utils.GenericDataType.NUMERIC,
+        ),
+        (
+            re.compile(r"^smallint.*", re.IGNORECASE),
+            types.SmallInteger(),

Review comment:
       Are `types.SMALLINT` and `types.SmallInteger()` interchangeable? If yes, 
can we stick to just one of them?
   

##########
File path: superset/db_engine_specs/postgres.py
##########
@@ -45,6 +47,96 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
     engine = ""
     engine_name = "PostgreSQL"
 
+    column_type_mappings = (
+        (
+            re.compile(r"^smallint", re.IGNORECASE),
+            types.SMALLINT,
+            utils.GenericDataType.NUMERIC,

Review comment:
       But, is adding `GenericDataType` here really necessary, though? I'd 
imagine all SQLA types could be definitively mapped to a `GenericDataType`, 
wouldn't they? Maybe `ColumnSpec` can just have an instance `@property` to map 
all known SQLA types to `GenericDataType`?

##########
File path: superset/db_engine_specs/postgres.py
##########
@@ -45,6 +47,96 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
     engine = ""
     engine_name = "PostgreSQL"
 
+    column_type_mappings = (
+        (
+            re.compile(r"^smallint", re.IGNORECASE),
+            types.SMALLINT,
+            utils.GenericDataType.NUMERIC,

Review comment:
       Nit: can we import `GenericDataType` directly and get rid of the 
`utils.` prefix? Just want the code the look cleaner.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to