def _parseTable(table: PageElement): print('table =======>', table) tb = dict({ "table": table.get('name', ''), "numRows": table.get('numrows', ''), #"remarks": table.get('remarks', '') }) cols = table.findAllNext('column') def _parseCol(col: PageElement): col_dict = { "col_name": col.get('name', 'unknown name'), "col_remarks": col.get('remarks', ''), "autoUpdated": col.get('autoupdated', ''), "nullable": col.get('nullable', ''), } return col_dict columns = list(map(_parseCol, cols)) cols = {"columns": list(columns)} tab = {"tb": tb} return {**tab, **cols}
def _parseTr(tr: PageElement): tds = tr.findAllNext("td") return { "Table": tds[0].text, "Column": tds[1].text, "Type": tds[2].text, "Size": tds[3].text, "Nulls": tds[4].text, "Auto": tds[5].text, "Default": tds[6].text }