villebro commented on a change in pull request #10244:
URL:
https://github.com/apache/incubator-superset/pull/10244#discussion_r450588559
##########
File path: superset/connectors/sqla/models.py
##########
@@ -1188,12 +1188,16 @@ def fetch_metadata(self, commit: bool = True) -> None:
any_date_col = None
db_engine_spec = self.database.db_engine_spec
db_dialect = self.database.get_dialect()
- dbcols = (
- db.session.query(TableColumn)
- .filter(TableColumn.table == self)
- .filter(or_(TableColumn.column_name == col.name for col in
table_.columns))
- )
- dbcols = {dbcol.column_name: dbcol for dbcol in dbcols}
+
+ try:
+ dbcols = (
+ db.session.query(TableColumn)
+ .filter(TableColumn.table == self)
+ .filter(TableColumn.column_name.in_([col.name for col in
table.columns]))
+ )
+ dbcols = {dbcol.column_name: dbcol for dbcol in dbcols}
+ except Exception as e:
+ logger.error("Failed to get columns: " + str(e))
Review comment:
What exception are we trying to catch here? In general we should always
try to be as specific as possible as to what exception we are expecting to see,
as opposed to catching all `Exception`.
----------------------------------------------------------------
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]