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



##########
File path: superset/db_engine_specs/postgres.py
##########
@@ -45,6 +59,17 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
     engine = ""
     engine_name = "PostgreSQL"
 
+    column_type_mappings = (
+        (
+            re.compile(r"^double precision", re.IGNORECASE),
+            DOUBLE_PRECISION(),
+            GenericDataType.NUMERIC,
+        ),
+        (re.compile(r"^array.*", re.IGNORECASE), ARRAY(), 
utils.GenericDataType.STRING),

Review comment:
       It appears `ARRAY()` needs to be instantiated with a type: 
https://docs.sqlalchemy.org/en/14/dialects/postgresql.html#sqlalchemy.dialects.postgresql.ARRAY
 I think you'll need to use a callback to match the type of the array and then 
pass that as `item_type` (see `VARCHAR` in Presto spec).

##########
File path: superset/db_engine_specs/postgres.py
##########
@@ -144,3 +169,15 @@ def get_extra_params(database: "Database") -> Dict[str, 
Any]:
             engine_params["connect_args"] = connect_args
             extra["engine_params"] = engine_params
         return extra
+
+    def get_column_spec(  # type: ignore
+        self, native_type: Optional[str],
+    ) -> Union[ColumnSpec, None]:

Review comment:
       this should be a `@classmethod`




----------------------------------------------------------------
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