public async void ListTableColumnsTest() { TableColumnsList tableColumnsList = await hManager.ListTableColumns("testing", "table1"); if (string.IsNullOrEmpty(tableColumnsList.error)) { Console.WriteLine(string.Format("table {0}.{1} columns:", tableColumnsList.database, tableColumnsList.table)); tableColumnsList.columns.ForEach(c => { Console.WriteLine(string.Format("{0}({1}) => {2}", c.name, c.type, c.comment)); Task <ColumnDescribe> describeTableColumnTask = hManager.DescribeTableColumn(tableColumnsList.database, tableColumnsList.table, c.name); Task.WaitAll(describeTableColumnTask); var describeColumn = describeTableColumnTask.GetAwaiter().GetResult(); if (string.IsNullOrEmpty(describeColumn.error)) { Console.WriteLine(string.Format("{0}({1}) => {2}", describeColumn.column.name, describeColumn.column.type, describeColumn.column.comment)); } else { Console.WriteLine(((Error)describeColumn).ToString()); } }); } else { Console.WriteLine(((Error)tableColumnsList).ToString()); } }
public async Task <TableColumnsList> ListTableColumns(string database, string tableName) { if (string.IsNullOrEmpty(database) || string.IsNullOrEmpty(tableName)) { throw new Exception("database and table are required."); } TableColumnsList tableColumnsList = await Get <TableColumnsList>(_webHcatBaseUrl, _webHCatVersion, _webHCatUserName, requestURL.ListTableColumns(database, tableName)); return(tableColumnsList); }