villebro commented on a change in pull request #10645:
URL: 
https://github.com/apache/incubator-superset/pull/10645#discussion_r474548781



##########
File path: superset/connectors/sqla/models.py
##########
@@ -1287,61 +1320,42 @@ def fetch_metadata(self, commit: bool = True) -> 
MetadataResult:
         :param commit: should the changes be committed or not.
         :return: Tuple with lists of added, removed and modified column names.
         """
-        try:
-            new_table = self.get_sqla_table_object()
-        except SQLAlchemyError:
-            raise QueryObjectValidationError(
-                _(
-                    "Table %(table)s doesn't seem to exist in the specified 
database, "
-                    "couldn't fetch column information",
-                    table=self.table_name,
-                )
-            )
-
+        new_columns = self.external_metadata()
         metrics = []
         any_date_col = None
         db_engine_spec = self.database.db_engine_spec
-        db_dialect = self.database.get_dialect()
         old_columns = db.session.query(TableColumn).filter(TableColumn.table 
== self)
 
         old_columns_by_name = {col.column_name: col for col in old_columns}
         results = MetadataResult(
             removed=[
                 col
                 for col in old_columns_by_name
-                if col not in {col.name for col in new_table.columns}
+                if col not in {col["name"] for col in new_columns}
             ]
         )
 
         # clear old columns before adding modified columns back
         self.columns = []
-        for col in new_table.columns:
-            try:
-                datatype = db_engine_spec.column_datatype_to_string(
-                    col.type, db_dialect
-                )
-            except Exception as ex:  # pylint: disable=broad-except
-                datatype = "UNKNOWN"
-                logger.error("Unrecognized data type in %s.%s", new_table, 
col.name)
-                logger.exception(ex)

Review comment:
       This compilation step was moved to `external_metadata()` which is called 
earlier in the method, hence making this step redundant.




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