How to add columnDescription to a Azure Data Catalog table using REST API

125 Views Asked by At

I want to add column Description to my Azure Data Catalog assets. In the documentation, columnDescription is not under columns and that confuses me. Moreover I have tried to put it under annotations and it didn't work. Any support is appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

columnDescriptions should be under annotations. That is correct. Each columnDescription object has a columnName and a description. Passing multiple columnName and description pairs is the tricky task though. Here is how you would do it:

def getColumnDescriptions(columnDescriptions):
description = []
index = 0
for item in columnDescriptions:
    jsonFormat = {"properties": {"columnName": item["columnName"],
                                 "description": item["description"],
                                 "fromSourceSystem": False,
                                 "key": "column" + str(index) }}

    description.append(jsonFormat)
    index += 1;
return description

So in the end the key value pair should look like this:

{"columnDescriptions": [{"properties": {"columnName":   "Name",
                                 "description": "This is the description of the name",
                                 "fromSourceSystem": False,
                                 "key": "column1"}},
                        {"properties": {"columnName":   "Address",
                                 "description": "This is the description of the Address",
                                 "fromSourceSystem": False,
                                 "key": "column2"}}]}

Generally speaking, if we are passing an array of values (this can be applied to tags or experts as well), the syntax above can be used. At the moment there are no examples on the internet. So I hope it helps.