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.

How to retrieve the guid with an Atlas search

How to retrieve the guid with an Atlas search

New Contributor

I can select name and other attributes in a DSL (e.g. Sometype select name, date), but can't find any way to retrieve the guids of the results. How should I do this?

7 REPLIES 7
Highlighted

Re: How to retrieve the guid with an Atlas search

@f s

GUIS's are not displayed in the UI as these are not much helpful to the enduser. GUID's can be accessed from the developer tools window of the browser when the DSL query is executed. Attaching the snapshot for reference, the red circle in the UI snapshot represents the location from where you can access GUID . Let me know if this is helpful.

6847-atlas-2016-08-22-11-27-32.png

Highlighted

Re: How to retrieve the guid with an Atlas search

New Contributor

The UI in your screenshot is requesting all the attributes for hive_tables, which includes the id. However, I'm only selecting some of the attributes in my app to avoid wasting bandwidth (some of the unneeded attributes could contain a lot of data). In this case I can't see how to retrieve the id as well.

Highlighted

Re: How to retrieve the guid with an Atlas search

Rising Star

@f s

Note that you can also do this manual solution as well:

1. Search for for the entity you want the guid for in the Atlas UI

2. Click on the entity

Then in the browser's url space, you can see the guid of the entity. It will look something like

http://hw03.co.local:21000/index.html#!/detailPage/2ddcda5b-2489-4636-a9ab-12b199c02422 
Highlighted

Re: How to retrieve the guid with an Atlas search

Rising Star

Also note from here: https://community.hortonworks.com/questions/194352/qualifiedname-vs-guid.html

"If qualifiedName is constructed properly, they are pretty much the same as guid..."

and I find using these to be an easier way to tracking things in simple cases.

Highlighted

Re: How to retrieve the guid with an Atlas search

New Contributor

Sometype as sometype select sometype,name,date works, but returns so much metadata that just Sometype seems to do better overall.

Highlighted

Re: How to retrieve the guid with an Atlas search

Guru

@f s

Use a call to the REST API Types resource:

curl -u admin:admin -X GET http://sandbox.hortonworks.com:21000/api/atlas/entities?type=hive_table

That should give you all of the GUIDs of all of the instantiated entities that are of "type" you specify. The example shows how you would get the GUIDs of all hive_table entities.

{"requestId":"qtp1853177759-495 - c2507d2d-f202-416f-bc61-4459aa5b5c6d","typeName":"hive_table","results":["63683ca8-e5a9-4c4c-b02e-3fe01bfda2a2","563e7954-7d4c-45a6-9237-3e94e4d23f68","d24ee236-417e-4c12-ab0e-44bab7abb567","e7d3a765-662e-4303-ab32-251f22234382","2e42b030-25cc-4d94-8196-7df7903e61cd","7751030c-d902-41fd-992d-f209a8e5278e","6af5132f-ab31-4cb4-b895-7c42f9caeef8","a9d45d64-0aea-4d18-abcd-919f6a3ae1e7","405079e5-dd29-41dc-98e8-49dc6f70f36d"],"count":9}
Highlighted

Re: How to retrieve the guid with an Atlas search

New Contributor

You can refer to GUID as __guid when compile DSL search, like: 

from hive_table select __guid, name, qualifiedName

This is explained in the Atlas documentation:

https://atlas.apache.org/1.0.0/Search-Advanced.html, see there for "Using System Attributes". 

Here is screenshot from my Atlas in action: 

 

CaptureDSLwithGuid.PNG

Don't have an account?
Coming from Hortonworks? Activate your account here