public async Task <TableColumnDDL> CreateTableColumn(string database, string tableName, Models.WebHCat.WebHCatAPIReference.Request.HTable.Column column)
        {
            if (string.IsNullOrEmpty(database) || string.IsNullOrEmpty(tableName) || null == column)
            {
                throw new Exception("database, table and column are required.");
            }

            CreateColumnParams createParams = new CreateColumnParams();

            createParams.type    = column.type;
            createParams.comment = column.comment;

            TableColumnDDL createColumn = await Put <TableColumnDDL>(_webHcatBaseUrl, _webHCatVersion, _webHCatUserName, requestURL.CreateTableColumn(database, tableName, column.name), createParams);

            return(createColumn);
        }
Exemplo n.º 2
0
        public async void CreateTableColumnTes()
        {
            SharpHive.Models.WebHCat.WebHCatAPIReference.Request.HTable.Column column = new SharpHive.Models.WebHCat.WebHCatAPIReference.Request.HTable.Column()
            {
                name    = "date_of_birth",
                type    = "timestamp",
                comment = string.Empty
            };
            TableColumnDDL createColumn = await hManager.CreateTableColumn("testing", "table1", column);

            if (string.IsNullOrEmpty(createColumn.error))
            {
                Console.WriteLine(string.Format("Column {0}.{1}.{2} has been created", createColumn.database, createColumn.table, createColumn.column));
            }
            else
            {
                Console.WriteLine(((Error)createColumn).ToString());
            }
        }