常用graphql操作

localhost:9002/api/graphiql

获取鉴权token

输入

1
2
3
4
5
6
7
8
9
10
mutation {
createAccessToken(input: {type: PERSONAL, actorUrn: "urn:li:corpuser:datahub", duration: ONE_HOUR, name: "my personal token"}) {
accessToken
metadata {
id
name
description
}
}
}

执行

1
2
3
4
5
6
7
8
9
10
11
12
13
{
"data": {
"createAccessToken": {
"accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMiIsImp0aSI6ImM1ZjViOWRjLTg0ODktNDgxNS05ZDg5LTZkNzIyMTMyNjY0OCIsInN1YiI6ImRhdGFodWIiLCJleHAiOjE2ODA0OTQ4NTQsImlzcyI6ImRhdGFodWItbWV0YWRhdGEtc2VydmljZSJ9.mESshq5MlbF24PiRAcbunVYpAJYP5vUSX6onYpfvn6A",
"metadata": {
"id": "h603AUtusRH7eHVT/Aw4g+p5tfEVw+Tf0oyCiMql310=",
"name": "my personal token",
"description": null
}
}
},
"extensions": {}
}

查询所有token

1
2
3
4
5
6
7
8
9
10
11
12
{
listAccessTokens(input: {start: 0, count: 100, filters: [{field: "ownerUrn", value: "urn:li:corpuser:datahub"}]}) {
start
count
total
tokens {
urn
id
actorUrn
}
}
}

撤销token

1
2
3
mutation {
revokeAccessToken(tokenId: "HnMJylxuowJ1FKN74BbGogLvXCS4w+fsd3MZdI35+8A=")
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMiIsImp0aSI6IjRjYzBlYjNkLWI4NmEtNDczMi1hYzczLWYyZjliMWY4NmUyOCIsInN1YiI6ImRhdGFodWIiLCJpc3MiOiJkYXRhaHViLW1ldGFkYXRhLXNlcnZpY2UifQ.fLtEwO24nc5IszuKunFm4EroZRhGuUaUR68s4iZiV8Q

curl -X POST 'http://localhost:9002/api/graphql' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMiIsImp0aSI6IjRjYzBlYjNkLWI4NmEtNDczMi1hYzczLWYyZjliMWY4NmUyOCIsInN1YiI6ImRhdGFodWIiLCJpc3MiOiJkYXRhaHViLW1ldGFkYXRhLXNlcnZpY2UifQ.fLtEwO24nc5IszuKunFm4EroZRhGuUaUR68s4iZiV8Q' \
--header 'Content-Type: application/json' \
-d '{"query":"{\n me {\n corpUser {\n username\n }\n }\n}","variables":{}}'

eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMiIsImp0aSI6ImExMDQ3OTIzLWRjNzYtNGQwZC1hYzNkLTg3MGI5ODVhNjkyZCIsInN1YiI6ImRhdGFodWIiLCJleHAiOjE2ODM5NDczODMsImlzcyI6ImRhdGFodWItbWV0YWRhdGEtc2VydmljZSJ9.KqWKqA_x1rjn8UcYuW_X9pxLyRY47y6eFVmARk3JnII

curl -X POST 'http://localhost:9002/api/graphql' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMiIsImp0aSI6ImExMDQ3OTIzLWRjNzYtNGQwZC1hYzNkLTg3MGI5ODVhNjkyZCIsInN1YiI6ImRhdGFodWIiLCJleHAiOjE2ODM5NDczODMsImlzcyI6ImRhdGFodWItbWV0YWRhdGEtc2VydmljZSJ9.KqWKqA_x1rjn8UcYuW_X9pxLyRY47y6eFVmARk3JnII' \
--header 'Content-Type: application/json' \
--data '{"query":"{\n me {\n corpUser {\n username\n }\n }\n}","variables":{}}'

curl 'http://localhost:9002/api/gms/entities/urn:li:corpuser:datahub' -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhY3RvclR5cGUiOiJVU0VSIiwiYWN0b3JJZCI6ImRhdGFodWIiLCJ0eXBlIjoiUEVSU09OQUwiLCJ2ZXJzaW9uIjoiMiIsImp0aSI6ImExMDQ3OTIzLWRjNzYtNGQwZC1hYzNkLTg3MGI5ODVhNjkyZCIsInN1YiI6ImRhdGFodWIiLCJleHAiOjE2ODM5NDczODMsImlzcyI6ImRhdGFodWItbWV0YWRhdGEtc2VydmljZSJ9.KqWKqA_x1rjn8UcYuW_X9pxLyRY47y6eFVmARk3JnII

查token

1
2
3
4
5
6
7
{
me{
corpUser{
username
}
}
}

查询mysql数据源属性

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
ingestionSource(urn:"urn:li:dataHubIngestionSource:ad984b8a-28be-4faa-b397-d8dc3a18c643"){
urn
type
name
platform{
urn
name
}
config{
recipe
executorId
version
}
executions{
start
count
}
}
}
java -jar C:\Users\Developer\.m2\repository\org\example\table-manage\1.0-SNAPSHOT\table-manage-1.0-SNAPSHOT.jar

列出所有域

1
2
3
4
5
6
7
8
9
10
11
listDomains(input:{start:0,count:100}){
domains{
urn
type
id
properties{
name
description
}
}
}

获取所有根词汇节点

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
getRootGlossaryNodes(input:{start:0,count:100}){
count
nodes{
urn
properties{
name
}
parentNodes{
nodes{
urn
properties{
name
}
}
}
}
}
}

获取所有根词汇术语

1
2
3
4
5
6
7
8
9
10
11
{
getRootGlossaryTerms(input:{start:0,count:100}){
count
terms{
urn
properties{
name
}
}
}
}

用dataSet的urn查dataSet信息

1
2
3
4
5
6
7
8
9
10
11
12
{
dataset(urn:"urn:li:container:ee6a71df5d49df25c6f9e879ebef78a1"){
lastIngested
subTypes{
typeNames
}
relationships(input:{start:0,count:100,types:"",direction:INCOMING}){
total

}
}
}