Search…
GraphQL Metadata API
Datafold exposes a GraphQL Metadata API that allows exporting metadata such as table and column descriptions and lineage.
The API has the following schema:
1
directive @auth on FIELD_DEFINITION
2
directive @perm(allow: [String!]!) on FIELD_DEFINITION
3
4
# Base types
5
scalar Datetime
6
7
8
interface BaseItem {
9
uid: ID!
10
}
11
12
interface PagedResult {
13
page: PageInfo!
14
}
15
16
type PageInfo {
17
cursor: ID
18
total: Int!
19
page: Int!
20
first: Int!
21
}
22
23
type TableList implements PagedResult {
24
page: PageInfo!
25
items: [Table!]
26
}
27
28
type ColumnList implements PagedResult {
29
page: PageInfo!
30
items: [Column!]
31
}
32
33
type TagList implements PagedResult {
34
page: PageInfo!
35
items: [Tag!]
36
}
37
38
type TagConnectionsList implements PagedResult {
39
page: PageInfo!
40
items: [TagConnections!]
41
}
42
43
enum TagSource {
44
user_input
45
dbt
46
warehouse
47
lineage
48
}
49
50
type Tag implements BaseItem {
51
uid: ID!
52
name: String!
53
color: String
54
attached: Boolean!
55
initialSource: TagSource,
56
connections (first: Int, cursor: ID): TagConnectionsList
57
}
58
59
type Organization implements BaseItem {
60
uid: ID!
61
name: String!
62
users: [User!] @perm(allow:["list_users"])
63
dataSources: [DataSource!] @perm(allow:["list_data_sources"])
64
biDataSources: [BiDataSource!] @perm(allow:["list_data_sources"])
65
}
66
67
type User implements BaseItem {
68
uid: ID!
69
org: Organization!
70
name: String!
71
email: String!
72
}
73
74
type DataSource implements BaseItem {
75
uid: ID!
76
name: String!
77
type: String!
78
owner: User!
79
org: Organization!
80
oneDatabase: Boolean!
81
hasSchemaIndexing: Boolean!
82
discourageManualProfiling: Boolean!
83
createdAt: Datetime!
84
databases: [Database!]
85
tables (first: Int, cursor: ID): TableList!
86
}
87
88
type Database {
89
name: String!
90
schemas: [Schema!]
91
}
92
93
type Schema {
94
name: String!
95
tablesCount: Int!
96
}
97
98
type TableCreatedBySqlQuery {
99
text: String!
100
timestamp: Datetime
101
}
102
103
type TableCreatedBySql {
104
queries: [TableCreatedBySqlQuery]!
105
sessionId: Int
106
startedAt: Datetime
107
completedAt: Datetime
108
}
109
110
type Table implements BaseItem {
111
uid: ID!
112
prop: TableProp!
113
lastModifiedAt: Datetime
114
descriptions: [TableDesc!]
115
tagIds: [ID!]
116
tags: [Tag!]
117
columnIds: [ID!]
118
columns: [Column!]
119
createdBySql: [TableCreatedBySql]
120
}
121
122
type TableProp {
123
path: String!
124
dataSourceId: ID!
125
createdBySessionIds: [Int!]
126
}
127
128
type TableDesc {
129
userId: ID!
130
dataOwnerId: ID!
131
description: String
132
}
133
134
type Column implements BaseItem{
135
uid: ID!
136
tableId: ID!
137
table: Table!
138
prop: ColumnProp!
139
descriptions: [ColumnDesc!]
140
tagIds: [ID!]
141
tags: [Tag!]
142
upstreamIds: [ID!]
143
upstream: [Column!]
144
downstreamIds: [ID!]
145
downstream: [Column!]
146
dashboardIds: [ID!]
147
dashboards: [BiDashboard!]
148
}
149
150
type ColumnProp {
151
name: String!
152
type: String!
153
dbType: String!
154
number: Int
155
description: String
156
}
157
158
type ColumnDesc {
159
userId: ID!
160
description: String
161
}
162
163
# Unions
164
165
union SearchedItem = Tag | Table | Column | BiDashboard
166
union TagConnections = Table | Column
167
168
# BI - MODE
169
170
type BiModeReportProp {
171
description: String
172
githubLink: String
173
accountUsername: String
174
}
175
176
type BiModeReportStat {
177
createdAt: Datetime
178
updatedAt: Datetime
179
lastRunAt: Datetime
180
viewCount: Int!
181
runsCount: Int!
182
expectedRuntime: Float
183
}
184
185
union BiDashboardStat = BiModeReportStat
186
union BiDashboardProp = BiModeReportProp
187
188
# BI
189
190
enum BiType {
191
mode
192
}
193
194
type BiQuery {
195
uid: ID!
196
remoteId: String!
197
name: String!
198
usage: Int!
199
text: String
200
uses: [Column!]
201
}
202
203
type BiDashboardElement {
204
uid: ID!
205
remoteId: String!
206
name: String!
207
queries: [BiQuery!]
208
}
209
210
type BiDashboard {
211
uid: ID!
212
remoteId: String!
213
name: String!
214
webLink: String
215
webPreviewImage: String
216
popularity: Float
217
stats: BiDashboardStat
218
props: BiDashboardProp
219
parentDatasource: BiDataSource!
220
parentWorkspace: BiWorkspace!
221
parentSpace: BiSpace!
222
elements: [BiDashboardElement!]
223
}
224
225
type BiDashboardList implements PagedResult {
226
page: PageInfo!
227
items: [BiDashboard!]
228
}
229
230
type BiSpace {
231
uid: ID!
232
remoteId: String!
233
name: String!
234
parentDatasource: BiDataSource
235
parentWorkspace: BiWorkspace
236
dashboards (first: Int, cursor: ID): BiDashboardList
237
}
238
239
type BiSpaceList implements PagedResult {
240
page: PageInfo!
241
items: [BiSpace!]
242
}
243
244
type BiWorkspace {
245
uid: ID!
246
remoteId: String!
247
name: String!
248
parentDatasource: BiDataSource
249
spaces (first: Int, cursor: ID): BiSpaceList
250
}
251
252
type BiWorkspaceList implements PagedResult {
253
page: PageInfo!
254
items: [BiWorkspace!]
255
}
256
257
type BiDataSource {
258
uid: ID,
259
name: String!
260
type: BiType!
261
org: Organization!,
262
workspaces (first: Int, cursor: ID): BiWorkspaceList
263
}
264
265
# Lineage items
266
union LineagePrimaryEntity = Table | BiDashboard
267
union LineageConnectedEntity = Table | Column | BiDashboard
268
269
enum LineageDirection {
270
UPSTREAM,
271
DOWNSTREAM,
272
DASHBOARD,
273
OFF_CHART,
274
NEXT_BATCH_UPSTREAM,
275
NEXT_BATCH_DOWNSTREAM
276
}
277
278
enum LineageType {
279
DIRECT
280
}
281
282
type LineageResult {
283
primary: LineagePrimaryEntity!
284
entities: [LineageConnectedEntity!]
285
edges: [LineageEdge!]
286
}
287
288
type LineageEdge {
289
direction: LineageDirection!
290
type: LineageType!
291
sourceUid: ID
292
destinationUid: ID
293
}
294
295
input LineageFilter {
296
depthUpstream: Int
297
depthDownstream: Int
298
biLastUsedDays: Int
299
biPopularity: [Int!]
300
}
301
302
# Search items
303
304
enum SearchLabel {
305
Table
306
Column
307
Tag
308
BiDashboard
309
}
310
311
type SearchStatId {
312
count: Int!
313
item: ID!
314
}
315
316
type SearchStatTag {
317
count: Int!
318
tag: Tag!
319
}
320
321
type SearchStatLabel {
322
count: Int!
323
item: SearchLabel!
324
}
325
326
type SearchResult {
327
score: Float!
328
item: SearchedItem!
329
}
330
331
type SearchStats {
332
dataSources: [SearchStatId!]!
333
tags: [SearchStatTag!]!
334
dataOwnerIds: [SearchStatId!]!
335
labels: [SearchStatLabel!]!
336
}
337
338
type SearchList implements PagedResult {
339
page: PageInfo!
340
stats: SearchStats!
341
results: [SearchResult!]
342
}
343
344
type Query {
345
version: String
346
# Complex methods
347
lineage(
348
primaryUid: ID!,
349
lineageFilter: LineageFilter
350
allowedList: [ID!]
351
): LineageResult! @auth
352
# Selection
353
search(
354
query: String,
355
paths: [String!]
356
tagUids: [ID!]
357
dataOwnerIds: [Int!]
358
labels: [SearchLabel!]
359
ranking: Boolean
360
bi_last_used_days: Int,
361
bi_popularity: [Int!],
362
first: Int
363
cursor: ID
364
): SearchList! @auth
365
# Base methods
366
me: User! @auth
367
org: Organization! @auth
368
table(path: String): Table @auth
369
# Batch methods
370
tables(uids: [ID!], dataSourceId: ID, first: Int, cursor: ID): TableList @auth
371
columns(uids: [ID!]!): ColumnList @auth
372
tags(uids: [ID!], first: Int, cursor: ID, activeOnly: Boolean): TagList @auth
373
biWorkspaces(uids: [ID!], biDataSourceId: ID, first: Int, cursor: ID): BiWorkspaceList @auth
374
biSpaces(uids: [ID!], biWorkspaceId: ID, first: Int, cursor: ID): BiSpaceList @auth
375
biDashboards(uids: [ID!], biSpaceId: ID, first: Int, cursor: ID): BiDashboardList @auth
376
}
377
378
schema {
379
query: Query
380
}
Copied!
Last modified 27d ago
Copy link