Support Questions

Find answers, ask questions, and share your expertise

Querying Atlas for tables created after a certain date/time

avatar

Im using HDP 2.6 and I'm trying to use DSL to query Atlas for tables created after a certain date. So far, I've tried querying based on the attribute "createTime" but am unable to figure out the date format used (milliseconds, seconds, etc...). It seems that it only takes year (>2017, <2018) but nothing more.

Does anyone have any idea how to query for tables created/modified after a certain date/time?

1 ACCEPTED SOLUTION

avatar

You can query using the API for entities created/modified after a certain date. You would do this by running a DSL query against the “createTime” attribute via rest.

For example, if you would like to query for hive tables created/modified after 2017-04-18 6:49pm Your rest call would look like:

http://localhost:21000/api/atlas/v2/search/dsl?query=createTime%3E'2017-04-18T18%3A49%3A44.000Z'&typeName=hive_table

The date format is as follows:

{yyyy}-{mm}-{dd}T{hh}:{mm}:{ss}.{zzz}Z

{year}-{month}-{day}T{hours}:{minutes}:{seconds}.{timezone}Z

e.g. 2017-04-18T18:49:44.000Z

You can also use a subset of the date rather than the entire string. For example you can query by year only (2017), full date only (2017-04-18), date and time only (2017-04-18T18:49:44)

View solution in original post

2 REPLIES 2

avatar

You can query using the API for entities created/modified after a certain date. You would do this by running a DSL query against the “createTime” attribute via rest.

For example, if you would like to query for hive tables created/modified after 2017-04-18 6:49pm Your rest call would look like:

http://localhost:21000/api/atlas/v2/search/dsl?query=createTime%3E'2017-04-18T18%3A49%3A44.000Z'&typeName=hive_table

The date format is as follows:

{yyyy}-{mm}-{dd}T{hh}:{mm}:{ss}.{zzz}Z

{year}-{month}-{day}T{hours}:{minutes}:{seconds}.{timezone}Z

e.g. 2017-04-18T18:49:44.000Z

You can also use a subset of the date rather than the entire string. For example you can query by year only (2017), full date only (2017-04-18), date and time only (2017-04-18T18:49:44)

avatar
Contributor

@Eyad Garelnabi

Above DSL Search query is working for creating time only , Its not working for Modified Time

Find below query with modified time , Its not working

http://localhost:21000/api/atlas/v2/search/dsl?query=modifiedTime%3E'2017-08-02T16%3A33%3A23.408Z'&typeName=hive_table

Please help on this..!!!