Atlas exposes search over the metadata in two ways:
The basic search allows you to query using typename of an entity, associated classification/tag and has support for filtering on the entity attribute(s) as well as the classification/tag attributes.
The entire query structure can be represented using the following JSON structure (called SearchParameters)
{ "typeName": "hive_table", "excludeDeletedEntities": true, "classification" : "", "query": "", "limit": 25, "offset": 0, "entityFilters": { "attributeName": "name", "operator": "contains", "attributeValue": "testtable" }, "tagFilters": null, "attributes": [""] }
Field description
Attribute based filtering can be done on multiple attributes with AND/OR condition.
NOTE: The tagFilters and entityFilters field have same JSON structure.
Examples of filtering (for hive_table attributes)
{ "typeName": "hive_table", "excludeDeletedEntities": true, "classification" : "", "query": "", "limit": 50, "offset": 0, "entityFilters": { "attributeName": "name", "operator": "contains", "attributeValue": "testtable" }, "tagFilters": null, "attributes": [""] }
{ "typeName": "hive_table", "excludeDeletedEntities": true, "classification" : "", "query": "", "limit": 50, "offset": 0, "entityFilters": { "condition": "OR", "criterion": [ { "attributeName": "name", "operator": "contains", "attributeValue": "testtable" }, { "attributeName": "owner", "operator": "eq", "attributeValue": "admin" } ] }, "tagFilters": null, "attributes": [""] }
{ "typeName": "hive_table", "excludeDeletedEntities": true, "classification" : "", "query": "", "limit": 50, "offset": 0, "entityFilters": { "condition": "AND", "criterion": [ { "attributeName": "name", "operator": "contains", "attributeValue": "testtable" }, { "attributeName": "owner", "operator": "eq", "attributeValue": "admin" } ] }, "tagFilters": null, "attributes": [""] }
Supported operators for filtering
CURL Samples
curl -sivk -g -u <user>:<password> -X POST -d '{ "typeName": "hive_table", "excludeDeletedEntities": true, "classification" : "", "query": "", "limit": 50, "offset": 0, "entityFilters": { "condition": "AND", "criterion": [ { "attributeName": "name", "operator": "contains", "attributeValue": "testtable" }, { "attributeName": "owner", "operator": "eq", "attributeValue": "admin" } ] }, "tagFilters": null, "attributes": [""] }' <protocol>://<atlas_host>:<atlas_port>/api/atlas/v2/search/basic
The DSL exposes an SQL like query language for searching the metadata based on the type system. The grammar for the DSL is below.
queryWithPath: query ~ opt(WITHPATH) query: querySrc ~ opt(loopExpression) ~ opt(groupByExpr) ~ opt(selectClause) ~ opt(orderby) ~ opt(limitOffset) querySrc: rep1sep(singleQrySrc, opt(COMMA)) singleQrySrc = FROM ~ fromSrc ~ opt(WHERE) ~ opt(expr ^? notIdExpression) | WHERE ~ (expr ^? notIdExpression) | expr ^? notIdExpression | fromSrc ~ opt(WHERE) ~ opt(expr ^? notIdExpression) fromSrc: identifier ~ AS ~ alias | identifier groupByExpr = GROUPBY ~ (LPAREN ~> rep1sep(selectExpression, COMMA) <~ RPAREN) orderby: ORDERBY ~ expr ~ opt (sortOrder) limitOffset: LIMIT ~ lmt ~ opt (offset) offset: OFFSET ~ offsetValue sortOrder = ASC | DESC loopExpression: LOOP ~ (LPAREN ~> query <~ RPAREN) ~ opt(intConstant <~ TIMES) ~ opt(AS ~> alias) selectClause: SELECT ~ rep1sep(selectExpression, COMMA) countClause = COUNT ~ LPAREN ~ RPAREN maxClause = MAX ~ (LPAREN ~> expr <~ RPAREN) minClause = MIN ~ (LPAREN ~> expr <~ RPAREN) sumClause = SUM ~ (LPAREN ~> expr <~ RPAREN) selectExpression: expr ~ opt(AS ~> alias) expr: compE ~ opt(rep(exprRight)) exprRight: (AND | OR) ~ compE compE: arithE ~ (LT | LTE | EQ | NEQ | GT | GTE) ~ arithE | arithE ~ (ISA | IS) ~ ident | arithE ~ HAS ~ ident | arithE | countClause | maxClause | minClause | sumClause arithE: multiE ~ opt(rep(arithERight)) arithERight: (PLUS | MINUS) ~ multiE multiE: atomE ~ opt(rep(multiERight)) multiERight: (STAR | DIV) ~ atomE atomE: literal | identifier | LPAREN ~> expr <~ RPAREN identifier: rep1sep(ident, DOT) alias: ident | stringLit literal: booleanConstant | intConstant | longConstant | floatConstant | doubleConstant | stringLit
Grammar language: {noformat} opt(a) => a is optional ~ => a combinator. 'a ~ b' means a followed by b rep => zero or more rep1sep => one or more, separated by second arg. {noformat}
Language Notes:
For the model, Asset - attributes name, owner, description DB - supertype Asset - attributes clusterName, parameters, comment Column - extends Asset - attributes type, comment Table - supertype Asset - db, columns, parameters, comment Traits - PII, Log Data
DSL queries: * from DB