@@ -302,6 +302,36 @@ def has_table(self, connection, table_name, schema=None, **kwargs) -> bool:
302302else :
303303raise e
304304
305+ def get_table_comment (self ,connection ,table_name ,schema = None ,** kw ):
306+ r"""Return the "comment" for the table identified by `table_name`.
307+
308+ Given a string `table_name` and an optional string `schema`, return
309+ table comment information as a dictionary with this key:
310+
311+ returns:
312+ dict = {"text": "Table comment here"}
313+
314+ """
315+ COMMENT = 2
316+ schema_str = schema
317+ table_name_str = table_name
318+
319+ with self .get_driver_connection (
320+ connection
321+ )._dbapi_connection .dbapi_connection .cursor ()as cur :
322+ sql_str = """SELECT table_schema, table_name, comment
323+ FROM information_schema.tables
324+ WHERE table_schema = '{schema}'
325+ AND table_name = '{table}';""" .format (
326+ schema = schema_str ,
327+ table = table_name_str
328+ )
329+ # TODO: Add if scenario for None schema
330+ data = cur .execute (sql_str ).fetchall ()
331+ _comment = [i [COMMENT ]for i in data ]
332+
333+ return {"text" :_comment }
334+
305335@reflection .cache
306336def get_schema_names (self ,connection ,** kw ):
307337# Equivalent to SHOW DATABASES