datajunction-server 0.0.1a104.dev0__tar.gz → 0.0.41__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -124,3 +124,5 @@ Untitled*
124
124
 
125
125
  # postgres
126
126
  postgres_metadata
127
+ postgres_superset
128
+ node_modules
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: datajunction-server
3
- Version: 0.0.1a104.dev0
3
+ Version: 0.0.41
4
4
  Summary: DataJunction server library for running to a DataJunction server
5
5
  Project-URL: Homepage, https://datajunction.io
6
6
  Project-URL: Repository, https://github.com/DataJunction/dj
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.12
14
14
  Requires-Python: <4.0,>=3.10
15
15
  Requires-Dist: alembic>=1.10.3
16
16
  Requires-Dist: antlr4-python3-runtime==4.13.1
17
- Requires-Dist: bcrypt>=4.0.1
17
+ Requires-Dist: bcrypt<=4.3.0,>=4.0.1
18
18
  Requires-Dist: cachelib<1.0.0,>=0.10.2
19
19
  Requires-Dist: cachetools>=5.3.1
20
20
  Requires-Dist: celery<6.0.0,>=5.2.7
@@ -31,7 +31,8 @@ Requires-Dist: nbformat>=5.10.4
31
31
  Requires-Dist: opentelemetry-instrumentation-fastapi==0.38b0
32
32
  Requires-Dist: passlib>=1.7.4
33
33
  Requires-Dist: psycopg>=3.1.16
34
- Requires-Dist: pydantic<2
34
+ Requires-Dist: pydantic-settings>=2.10.1
35
+ Requires-Dist: pydantic<2.11,>=2.0
35
36
  Requires-Dist: python-dotenv<1.0.0,>=0.19.0
36
37
  Requires-Dist: python-jose>=3.3.0
37
38
  Requires-Dist: python-multipart>=0.0.20
@@ -41,9 +42,13 @@ Requires-Dist: rich<14.0.0,>=13.3.3
41
42
  Requires-Dist: sqlalchemy-utils<1.0.0,>=0.40.0
42
43
  Requires-Dist: sqlalchemy>=2
43
44
  Requires-Dist: sse-starlette<=2.0.0,>=1.6.0
44
- Requires-Dist: strawberry-graphql>=0.204.0
45
+ Requires-Dist: strawberry-graphql>=0.235.0
45
46
  Requires-Dist: types-cachetools>=5.3.0.6
46
47
  Requires-Dist: yarl<2.0.0,>=1.8.2
48
+ Provides-Extra: all
49
+ Requires-Dist: snowflake-connector-python>=3.0.0; extra == 'all'
50
+ Provides-Extra: snowflake
51
+ Requires-Dist: snowflake-connector-python>=3.0.0; extra == 'snowflake'
47
52
  Provides-Extra: transpilation
48
53
  Requires-Dist: sqlglot>=18.0.1; extra == 'transpilation'
49
54
  Provides-Extra: uvicorn
@@ -75,15 +75,22 @@ type DJError {
75
75
  scalar DateTime
76
76
 
77
77
  type DecomposedMetric {
78
- components: [MetricComponent!]!
79
- derivedQuery: String!
80
78
  derivedExpression: String!
79
+ components: [MetricComponent!]!
80
+ combiner: String!
81
+ derivedQuery: String
81
82
  }
82
83
 
83
84
  enum Dialect {
84
85
  SPARK
85
86
  TRINO
86
87
  DRUID
88
+ POSTGRES
89
+ CLICKHOUSE
90
+ DUCKDB
91
+ REDSHIFT
92
+ SNOWFLAKE
93
+ SQLITE
87
94
  }
88
95
 
89
96
  type DialectInfo {
@@ -156,6 +163,11 @@ enum ErrorCode {
156
163
  INVALID_PARENT
157
164
  INVALID_DIMENSION
158
165
  INVALID_METRIC
166
+ INVALID_DIMENSION_LINK
167
+ INVALID_CUBE
168
+ TAG_NOT_FOUND
169
+ CATALOG_NOT_FOUND
170
+ INVALID_NAMESPACE
159
171
  }
160
172
 
161
173
  type GeneratedSQL {
@@ -196,10 +208,23 @@ type MaterializationConfig {
196
208
  strategy: String
197
209
  }
198
210
 
211
+ type MaterializationPlan {
212
+ units: [MaterializationUnit!]!
213
+ }
214
+
215
+ type MaterializationUnit {
216
+ upstream: VersionedRef!
217
+ grainDimensions: [VersionedRef!]!
218
+ measures: [MetricComponent!]!
219
+ filterRefs: [VersionedRef!]!
220
+ filters: [String!]!
221
+ }
222
+
199
223
  type MetricComponent {
200
224
  name: String!
201
225
  expression: String!
202
226
  aggregation: String
227
+ merge: String
203
228
  rule: AggregationRule!
204
229
  }
205
230
 
@@ -230,6 +255,7 @@ type Node {
230
255
  revisions: [NodeRevision!]!
231
256
  tags: [TagBase!]!
232
257
  createdBy: User!
258
+ owners: [User!]!
233
259
  editedBy: [String!]!
234
260
  }
235
261
 
@@ -251,6 +277,12 @@ type NodeName {
251
277
  name: String!
252
278
  }
253
279
 
280
+ type NodeNameVersion {
281
+ name: String!
282
+ currentVersion: String!
283
+ type: String!
284
+ }
285
+
254
286
  type NodeRevision {
255
287
  id: Union!
256
288
  type: NodeType!
@@ -263,8 +295,7 @@ type NodeRevision {
263
295
  updatedAt: DateTime!
264
296
  customMetadata: JSON
265
297
  query: String
266
- dimensionLinks: [DimensionLink!]!
267
- parents: [NodeName!]!
298
+ parents: [NodeNameVersion!]!
268
299
  availability: AvailabilityState
269
300
  materializations: [MaterializationConfig!]
270
301
  schema_: String
@@ -272,6 +303,7 @@ type NodeRevision {
272
303
  requiredDimensions: [Column!]
273
304
  catalog: Catalog
274
305
  columns(attributes: [String!] = null): [Column!]!
306
+ dimensionLinks: [DimensionLink!]!
275
307
  primaryKey: [String!]!
276
308
  metricMetadata: MetricMetadata
277
309
  extractedMeasures: DecomposedMetric
@@ -279,6 +311,16 @@ type NodeRevision {
279
311
  cubeDimensions: [DimensionAttribute!]!
280
312
  }
281
313
 
314
+ enum NodeSortField {
315
+ NAME
316
+ DISPLAY_NAME
317
+ TYPE
318
+ STATUS
319
+ MODE
320
+ CREATED_AT
321
+ UPDATED_AT
322
+ }
323
+
282
324
  enum NodeStatus {
283
325
  VALID
284
326
  INVALID
@@ -361,8 +403,42 @@ type Query {
361
403
  """Filter to nodes tagged with these tags"""
362
404
  tags: [String!] = null
363
405
 
406
+ """
407
+ Filter to nodes that have ALL of these dimensions. Accepts dimension node names or dimension attributes
408
+ """
409
+ dimensions: [String!] = null
410
+
411
+ """Filter to nodes edited by this user"""
412
+ editedBy: String = null
413
+
414
+ """Filter to nodes in this namespace"""
415
+ namespace: String = null
416
+
417
+ """Filter to nodes with this mode (published or draft)"""
418
+ mode: NodeMode = null
419
+
420
+ """Filter to nodes owned by this user"""
421
+ ownedBy: String = null
422
+
423
+ """Filter to nodes missing descriptions (for data quality checks)"""
424
+ missingDescription: Boolean! = false
425
+
426
+ """Filter to nodes without any owners (for data quality checks)"""
427
+ missingOwner: Boolean! = false
428
+
429
+ """Filter to nodes with these statuses (e.g., VALID, INVALID)"""
430
+ statuses: [NodeStatus!] = null
431
+
432
+ """Filter to nodes that have materializations configured"""
433
+ hasMaterialization: Boolean! = false
434
+
435
+ """Filter to dimension nodes that are not linked to by any other node"""
436
+ orphanedDimension: Boolean! = false
437
+
364
438
  """Limit nodes"""
365
439
  limit: Int = 1000
440
+ orderBy: NodeSortField! = CREATED_AT
441
+ ascending: Boolean! = false
366
442
  ): [Node!]!
367
443
 
368
444
  """Find nodes based on the search parameters with pagination"""
@@ -379,16 +455,44 @@ type Query {
379
455
  """Filter to nodes tagged with these tags"""
380
456
  tags: [String!] = null
381
457
 
458
+ """
459
+ Filter to nodes that have ALL of these dimensions. Accepts dimension node names or dimension attributes
460
+ """
461
+ dimensions: [String!] = null
462
+
382
463
  """Filter to nodes edited by this user"""
383
464
  editedBy: String = null
384
465
 
385
466
  """Filter to nodes in this namespace"""
386
467
  namespace: String = null
468
+
469
+ """Filter to nodes with this mode (published or draft)"""
470
+ mode: NodeMode = null
471
+
472
+ """Filter to nodes owned by this user"""
473
+ ownedBy: String = null
474
+
475
+ """Filter to nodes missing descriptions (for data quality checks)"""
476
+ missingDescription: Boolean! = false
477
+
478
+ """Filter to nodes without any owners (for data quality checks)"""
479
+ missingOwner: Boolean! = false
480
+
481
+ """Filter to nodes with these statuses (e.g., VALID, INVALID)"""
482
+ statuses: [NodeStatus!] = null
483
+
484
+ """Filter to nodes that have materializations configured"""
485
+ hasMaterialization: Boolean! = false
486
+
487
+ """Filter to dimension nodes that are not linked to by any other node"""
488
+ orphanedDimension: Boolean! = false
387
489
  after: String = null
388
490
  before: String = null
389
491
 
390
492
  """Limit nodes"""
391
493
  limit: Int = 100
494
+ orderBy: NodeSortField! = CREATED_AT
495
+ ascending: Boolean! = false
392
496
  ): NodeConnection!
393
497
 
394
498
  """Get common dimensions for one or more nodes"""
@@ -399,11 +503,26 @@ type Query {
399
503
 
400
504
  """Find downstream nodes (optionally, of a given type) from a given node."""
401
505
  downstreamNodes(
402
- """The node name to find downstream nodes for."""
403
- nodeName: String!
506
+ """The node names to find downstream nodes for."""
507
+ nodeNames: [String!]!
404
508
 
405
509
  """The node type to filter the downstream nodes on."""
406
510
  nodeType: NodeType = null
511
+
512
+ """Whether to include deactivated nodes in the result."""
513
+ includeDeactivated: Boolean! = false
514
+ ): [Node!]!
515
+
516
+ """Find upstream nodes (optionally, of a given type) from a given node."""
517
+ upstreamNodes(
518
+ """The node names to find upstream nodes for."""
519
+ nodeNames: [String!]!
520
+
521
+ """The node type to filter the upstream nodes on."""
522
+ nodeType: NodeType = null
523
+
524
+ """Whether to include deactivated nodes in the result."""
525
+ includeDeactivated: Boolean! = false
407
526
  ): [Node!]!
408
527
 
409
528
  """Get measures SQL for a list of metrics, dimensions, and filters."""
@@ -423,8 +542,16 @@ type Query {
423
542
  Whether to pre-aggregate to the requested dimensions so that subsequent queries are more efficient.
424
543
  """
425
544
  preaggregate: Boolean! = false
545
+
546
+ """Query parameters to include in the SQL"""
547
+ queryParameters: JSON = null
426
548
  ): [GeneratedSQL!]!
427
549
 
550
+ """
551
+ Get materialization plan for a list of metrics, dimensions, and filters.
552
+ """
553
+ materializationPlan(cube: CubeDefinition!): MaterializationPlan!
554
+
428
555
  """Find DJ node tags based on the search parameters."""
429
556
  listTags(tagNames: [String!] = null, tagTypes: [String!] = null): [Tag!]!
430
557
 
@@ -485,4 +612,9 @@ type User {
485
612
  name: String
486
613
  oauthProvider: OAuthProvider!
487
614
  isAdmin: Boolean!
615
+ }
616
+
617
+ type VersionedRef {
618
+ name: String!
619
+ version: String!
488
620
  }
@@ -11,6 +11,9 @@ include = [
11
11
  packages = ["datajunction_server"]
12
12
  include = ["alembic/**", "alembic.ini"]
13
13
 
14
+ [tool.hatch.metadata]
15
+ allow-direct-references = true
16
+
14
17
  [tool.pdm]
15
18
  [tool.pdm.build]
16
19
  includes = ["dj"]
@@ -46,7 +49,7 @@ dependencies = [
46
49
  "passlib>=1.7.4",
47
50
  "python-jose>=3.3.0",
48
51
  "cryptography<=45.0.0",
49
- "bcrypt>=4.0.1",
52
+ "bcrypt<=4.3.0,>=4.0.1",
50
53
 
51
54
  # Google APIs
52
55
  "google-api-python-client>=2.95.0",
@@ -81,10 +84,11 @@ dependencies = [
81
84
  "nbformat>=5.10.4",
82
85
 
83
86
  # GraphQL
84
- "strawberry-graphql>=0.204.0",
87
+ "strawberry-graphql>=0.235.0",
85
88
 
86
89
  # Data validation
87
- "pydantic<2",
90
+ "pydantic<2.11,>=2.0",
91
+ "pydantic-settings>=2.10.1",
88
92
  ]
89
93
  requires-python = ">=3.10,<4.0"
90
94
  readme = "README.md"
@@ -105,6 +109,15 @@ transpilation = [
105
109
  "sqlglot>=18.0.1",
106
110
  ]
107
111
 
112
+ # Query client dependencies for different data warehouse vendors
113
+ snowflake = [
114
+ "snowflake-connector-python>=3.0.0",
115
+ ]
116
+
117
+ all = [
118
+ "snowflake-connector-python>=3.0.0",
119
+ ]
120
+
108
121
  [project.entry-points.'superset.db_engine_specs']
109
122
  dj = 'datajunction_server.superset:DJEngineSpec'
110
123
 
@@ -124,6 +137,13 @@ asyncio_mode = "auto"
124
137
  testpaths = [
125
138
  "tests",
126
139
  ]
140
+ norecursedirs = [
141
+ "tests/helpers",
142
+ ]
143
+
144
+ [tool.ruff.lint]
145
+ ignore = ["F811"]
146
+ exclude = ["datajunction_server/sql/parsing/backends/antlr4.py"]
127
147
 
128
148
  [tool.pdm.dev-dependencies]
129
149
  test = [
@@ -131,7 +151,7 @@ test = [
131
151
  "freezegun>=1.2.2",
132
152
  "pre-commit>=3.2.2",
133
153
  "pylint>=3.0.3",
134
- "pytest-asyncio<=0.22",
154
+ "pytest-asyncio>=1.2.0",
135
155
  "pytest-cov>=4.0.0",
136
156
  "pytest-integration>=0.2.2",
137
157
  "pytest-mock>=3.10.0",
@@ -147,7 +167,3 @@ test = [
147
167
  "sqlparse<1.0.0,>=0.4.3",
148
168
  "asgi-lifespan>=2",
149
169
  ]
150
-
151
- [tool.ruff.lint]
152
- ignore = ["F811"]
153
- exclude = ["datajunction_server/sql/parsing/backends/antlr4.py"]