- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
How to fetch total numbers of tables available in a Schema using Rest API search techniques ?
- Labels:
-
Apache Atlas
Created ‎06-09-2017 09:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to get the list pf all the tables available in a particular schema. This Rest API command generally gives the GUID and total count of all tables available in Atlas.
http://hostname:port/api/atlas/entities?type=hive_table
Can we apply some sort of filter on database or schema ?
Thank you,
Subash
Created ‎06-12-2017 08:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DSL query : hive_table where db.name="default" lists down all the hive tables in "default" database.
V1 Query which can be used in Atlas 0.7 :
/api/atlas/discovery/search/dsl?query=hive_table+where+db.name%3D%22default%22
Created ‎06-09-2017 06:41 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right now there isn't a way to sort the output. The consumer of this API will have to do the sorting.
Alternative to this would be to use DSL query. See this page for some samples.
DSL search converts the query into Gremlin query and then fires it on to the database.
Your query would be like this: hive_table orderby name
REST call would be: http://localhost:21000/api/atlas/v2/search/dsl?limit=25&excludeDeletedEntities
Hope this helps.
Created ‎06-12-2017 06:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey @Ashutosh Mestry,
I should have mentioned Atlas version as well. I am currently working on Atlas 0.7 and I guess the rest API request which you have mentioned will work on Atlas 0.8. Are there any similar rest API request available for Atlas 0.7 ?
Even if i will search on hive_table orderby name , It will list down all the tables from all schema. I am searching a way to list down list of all tables of a particular schema.
Thank you,
Subash
Created ‎06-09-2017 08:13 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Like @Ashutosh Mestry said this can be achieved through DSL or Gremlin calls.
from DB select count() as 'count' from Table select count() as 'count'
Also remember that the count queries are pretty expensive and might take a while to return results as it requires a major graph scan.
Created ‎06-12-2017 08:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
DSL query : hive_table where db.name="default" lists down all the hive tables in "default" database.
V1 Query which can be used in Atlas 0.7 :
/api/atlas/discovery/search/dsl?query=hive_table+where+db.name%3D%22default%22
Created ‎06-12-2017 08:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bingo, This is what i was looking for !
Thank you @Sharmadha Sainath
Created ‎06-12-2017 08:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Welcome @subash sharma . Please accept the answer if it answered your question.
Created ‎06-12-2017 09:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hey @Sharmadha Sainath, How to increase the limit of tables, I am getting only 100 tables using this script.
I tried using "limit" but limit is not working with 1000, It works when i am limiting the number of tables by giving values below 100.
Created ‎06-12-2017 09:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@subash sharma , add limit parameter like :
/api/atlas/discovery/search/dsl?query=hive_table+where+db.name%3D%22default%22&limit=500
Created ‎06-12-2017 10:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@subash sharma , limit parameter should work . How many tables are there in the database you are querying?
