Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

I am not getting $traits$ key in Rest API Call (Apache Atlas 0.7.0.2.5)

Highlighted

I am not getting $traits$ key in Rest API Call (Apache Atlas 0.7.0.2.5)

New Contributor

Hi,

I use to run this API command (Atlas 0.6) to fetch the schema details from the Atlas. My whole purpose was to identify the tagged and not tagged columns from the huge JSON output. In Atlas 0.6, For tags, One new key value pair use to get added for tagged columns, Key Name was '$traits$'.In Atlas 0.7, I am not getting any classifier for tagged and not tagged columns.

Basically the Rest End point was mentioned below.

atlas_hostname + '/api/atlas/discovery/search/dsl?query=hive_table+where+db.name%3D%22'+ database + '%22&limit=10000'

Whole Code is here :

atlas_hostname = 'hostname:21000'
database = 'mydb'
atlas_user_name = 'myuser'
atlas_password = 'mypassword'
headers = {'Accept': 'application/json, text/plain, */*','Content-Type': 'application/json;  charset=UTF-8'}

def atlas_get_request(atlas_hostname,database, atlas_user_name,atlas_password):
    try:
        list_of_table_json=requests.get(atlas_hostname + '/api/atlas/discovery/search/dsl?query=hive_table+where+db.name%3D%22'+ database + '%22&limit=10000' , headers=headers, auth=(atlas_user_name,atlas_password))
        dict_of_tables= list_of_table_json.json()
        result=dict_of_tables['results']
        return result
    except requests.exceptions.HTTPError as err:
        print (err)
        return  ("invalid Credentials or UI is unresponsive") 

I use to invoke the function atlas get request to fetch the schema details

result = atlas_get_request(atlas_hostname,database, atlas_user_name,atlas_password)

From the huge JSON response saved in "result", i used to filter the column key value pairs, Tagged column used to have an extra Key Value pair. Extra Key was "$traits$" in Atlas 0.6. Now in the column array of each and every column (in Atlas 0.7) i am getting only 9 key value pairs. No key value pairs which has the Tag details. Keys of the JSON dict mentioned below (tagged and untagged Column).

[u'comment', u'$id$', u'qualifiedName', u'description', u'$typeName$', u'owner', u'table', u'type', u'name']

I am using apache atlas 0.7. Let me know how to overcome this issue.

Thank you in advance,

Subash

1 REPLY 1

Re: I am not getting $traits$ key in Rest API Call (Apache Atlas 0.7.0.2.5)

New Contributor

Hi Subash,

I've tried to perform a search just like yours and you're right: it's not showing $traits$ key.

I tried something that worked for me: in your Rest End Point change the %22 to %27, just like this:

atlas_hostname + '/api/atlas/discovery/search/dsl?query=hive_table+where+db.name%3D%27'+ database + '%27&limit=10000'

I think it'll work.

Best Regards,

Ivan.