Vitor-Avila commented on code in PR #26744: URL: https://github.com/apache/superset/pull/26744#discussion_r1462293936
########## superset/db_engine_specs/db2.py: ########## @@ -52,3 +61,49 @@ class Db2EngineSpec(BaseEngineSpec): @classmethod def epoch_to_dttm(cls) -> str: return "(TIMESTAMP('1970-01-01', '00:00:00') + {col} SECONDS)" + + @classmethod + def get_table_comment( + cls, inspector: Inspector, table_name: str, schema: Union[str, None] + ) -> Optional[str]: + """ + Get comment of table from a given schema + + Ibm Db2 return comments as tuples, so we need to get the first element + + :param inspector: SqlAlchemy Inspector instance + :param table_name: Table name + :param schema: Schema name. If omitted, uses default schema for database + :return: comment of table + """ + comment = None + try: + table_comment = inspector.get_table_comment(table_name, schema) + comment = table_comment.get("text") + return comment[0] + except IndexError: Review Comment: In my tests it always returned a `Tuple()`, just added this as a precaution to avoid an issue in case we end up getting a `string`. I could remove this if we want to be more deterministic. -- 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. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org