datajunction-server 0.0.2.dev2__py3-none-any.whl → 0.0.2.dev3__py3-none-any.whl
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.
- datajunction_server/__about__.py +1 -1
- datajunction_server/models/deployment.py +60 -54
- {datajunction_server-0.0.2.dev2.dist-info → datajunction_server-0.0.2.dev3.dist-info}/METADATA +1 -1
- {datajunction_server-0.0.2.dev2.dist-info → datajunction_server-0.0.2.dev3.dist-info}/RECORD +6 -6
- {datajunction_server-0.0.2.dev2.dist-info → datajunction_server-0.0.2.dev3.dist-info}/WHEEL +0 -0
- {datajunction_server-0.0.2.dev2.dist-info → datajunction_server-0.0.2.dev3.dist-info}/entry_points.txt +0 -0
datajunction_server/__about__.py
CHANGED
|
@@ -65,7 +65,8 @@ class ColumnSpec(BaseModel):
|
|
|
65
65
|
and (self.display_name == other.display_name or self.display_name is None)
|
|
66
66
|
and (self.description == other.description or self.description is None)
|
|
67
67
|
and set(self.attributes) == set(other.attributes)
|
|
68
|
-
and (self.partition == other.partition)
|
|
68
|
+
and (self.partition == other.partition)
|
|
69
|
+
or (self.partition is None and other.partition is None)
|
|
69
70
|
)
|
|
70
71
|
|
|
71
72
|
|
|
@@ -242,11 +243,7 @@ class NodeSpec(BaseModel):
|
|
|
242
243
|
and set(self.owners) == set(other.owners)
|
|
243
244
|
and set(self.tags) == set(other.tags)
|
|
244
245
|
and self.mode == other.mode
|
|
245
|
-
and (
|
|
246
|
-
self.custom_metadata == other.custom_metadata
|
|
247
|
-
or self.custom_metadata is None
|
|
248
|
-
and other.custom_metadata == {}
|
|
249
|
-
)
|
|
246
|
+
and eq_or_fallback(self.custom_metadata, other.custom_metadata, {})
|
|
250
247
|
)
|
|
251
248
|
|
|
252
249
|
|
|
@@ -278,27 +275,19 @@ class LinkableNodeSpec(NodeSpec):
|
|
|
278
275
|
return value
|
|
279
276
|
|
|
280
277
|
def __eq__(self, other: Any) -> bool:
|
|
278
|
+
if not isinstance(other, LinkableNodeSpec):
|
|
279
|
+
return False
|
|
280
|
+
dimension_links_equal = sorted(
|
|
281
|
+
self.dimension_links or [],
|
|
282
|
+
key=lambda link: link.rendered_dimension_node,
|
|
283
|
+
) == sorted(
|
|
284
|
+
other.dimension_links or [],
|
|
285
|
+
key=lambda link: link.rendered_dimension_node,
|
|
286
|
+
)
|
|
281
287
|
return (
|
|
282
288
|
super().__eq__(other)
|
|
283
|
-
and (
|
|
284
|
-
|
|
285
|
-
or (
|
|
286
|
-
self.columns is None
|
|
287
|
-
and not any(
|
|
288
|
-
[attr for attr in col.attributes if attr != "primary_key"]
|
|
289
|
-
for col in other.columns
|
|
290
|
-
)
|
|
291
|
-
and not any(col.partition for col in other.columns)
|
|
292
|
-
)
|
|
293
|
-
)
|
|
294
|
-
and sorted(
|
|
295
|
-
self.dimension_links or [],
|
|
296
|
-
key=lambda link: link.rendered_dimension_node,
|
|
297
|
-
)
|
|
298
|
-
== sorted(
|
|
299
|
-
other.dimension_links or [],
|
|
300
|
-
key=lambda link: link.rendered_dimension_node,
|
|
301
|
-
)
|
|
289
|
+
and eq_columns(self.columns, other.columns)
|
|
290
|
+
and dimension_links_equal
|
|
302
291
|
)
|
|
303
292
|
|
|
304
293
|
|
|
@@ -368,6 +357,18 @@ class MetricSpec(NodeSpec):
|
|
|
368
357
|
min_decimal_exponent: int | None
|
|
369
358
|
max_decimal_exponent: int | None
|
|
370
359
|
|
|
360
|
+
def __init__(self, **data: Any):
|
|
361
|
+
unit = data.pop("unit", None)
|
|
362
|
+
if unit:
|
|
363
|
+
try:
|
|
364
|
+
if isinstance(unit, MetricUnit):
|
|
365
|
+
data["unit_enum"] = unit
|
|
366
|
+
else:
|
|
367
|
+
data["unit_enum"] = MetricUnit[unit.strip().upper()]
|
|
368
|
+
except KeyError:
|
|
369
|
+
raise DJInvalidInputException(f"Invalid metric unit: {unit}")
|
|
370
|
+
super().__init__(**data)
|
|
371
|
+
|
|
371
372
|
@property
|
|
372
373
|
def unit(self) -> str | None:
|
|
373
374
|
"""Return lowercased unit name for JSON serialization."""
|
|
@@ -387,11 +388,11 @@ class MetricSpec(NodeSpec):
|
|
|
387
388
|
super().__eq__(other)
|
|
388
389
|
and self.query_ast.compare(other.query_ast)
|
|
389
390
|
and (self.required_dimensions or []) == (other.required_dimensions or [])
|
|
390
|
-
and (self.direction
|
|
391
|
-
and (self.unit
|
|
392
|
-
and (self.significant_digits
|
|
393
|
-
and (self.min_decimal_exponent
|
|
394
|
-
and (self.max_decimal_exponent
|
|
391
|
+
and eq_or_fallback(self.direction, other.direction, MetricDirection.NEUTRAL)
|
|
392
|
+
and eq_or_fallback(self.unit, other.unit, MetricUnit.UNKNOWN.value.name)
|
|
393
|
+
and eq_or_none(self.significant_digits, other.significant_digits)
|
|
394
|
+
and eq_or_none(self.min_decimal_exponent, other.min_decimal_exponent)
|
|
395
|
+
and eq_or_none(self.max_decimal_exponent, other.max_decimal_exponent)
|
|
395
396
|
)
|
|
396
397
|
|
|
397
398
|
|
|
@@ -421,32 +422,9 @@ class CubeSpec(NodeSpec):
|
|
|
421
422
|
]
|
|
422
423
|
|
|
423
424
|
def __eq__(self, other: Any) -> bool:
|
|
424
|
-
print("!!!Comparing cubes", self.rendered_name, other.rendered_name,
|
|
425
|
-
"super:", super().__eq__(other),
|
|
426
|
-
"columns:", (self.columns or []) == (other.columns or []),
|
|
427
|
-
"othercol", ([
|
|
428
|
-
[attr for attr in col.attributes if attr != "primary_key"]
|
|
429
|
-
for col in other.columns
|
|
430
|
-
],
|
|
431
|
-
not any(col.partition for col in other.columns)
|
|
432
|
-
),
|
|
433
|
-
"metrics:", set(self.rendered_metrics) == set(other.rendered_metrics),
|
|
434
|
-
"dimensions:", set(self.rendered_dimensions) == set(other.rendered_dimensions),
|
|
435
|
-
"filters:", (self.rendered_filters or []) == (other.rendered_filters or [])
|
|
436
|
-
)
|
|
437
425
|
return (
|
|
438
426
|
super().__eq__(other)
|
|
439
|
-
and (
|
|
440
|
-
(self.columns or []) == (other.columns or [])
|
|
441
|
-
or (
|
|
442
|
-
not self.columns
|
|
443
|
-
and not any(
|
|
444
|
-
[attr for attr in col.attributes if attr != "primary_key"]
|
|
445
|
-
for col in other.columns
|
|
446
|
-
)
|
|
447
|
-
and not any(col.partition for col in other.columns)
|
|
448
|
-
)
|
|
449
|
-
)
|
|
427
|
+
and eq_columns(self.columns, other.columns)
|
|
450
428
|
and set(self.rendered_metrics) == set(other.rendered_metrics)
|
|
451
429
|
and set(self.rendered_dimensions) == set(other.rendered_dimensions)
|
|
452
430
|
and (self.rendered_filters or []) == (other.rendered_filters or [])
|
|
@@ -541,3 +519,31 @@ class DeploymentInfo(BaseModel):
|
|
|
541
519
|
namespace: str
|
|
542
520
|
status: DeploymentStatus
|
|
543
521
|
results: list[DeploymentResult] = Field(default_factory=list)
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
def eq_or_none(a, b):
|
|
525
|
+
"""
|
|
526
|
+
Helper to compare two values that may be None
|
|
527
|
+
"""
|
|
528
|
+
return a == b or (a is None and b is None)
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
def eq_or_fallback(a, b, fallback):
|
|
532
|
+
"""
|
|
533
|
+
Helper to compare two values that may be None, with a fallback value
|
|
534
|
+
"""
|
|
535
|
+
return a == b or (a is None and b == fallback)
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
def eq_columns(a, b):
|
|
539
|
+
"""
|
|
540
|
+
Helper to compare two lists of ColumnSpec that may be None
|
|
541
|
+
"""
|
|
542
|
+
return (a or []) == (b or []) or (
|
|
543
|
+
not a
|
|
544
|
+
and not any(
|
|
545
|
+
[attr for attr in col.attributes if attr != "primary_key"]
|
|
546
|
+
for col in b or []
|
|
547
|
+
)
|
|
548
|
+
and not any(col.partition for col in b or [])
|
|
549
|
+
)
|
{datajunction_server-0.0.2.dev2.dist-info → datajunction_server-0.0.2.dev3.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: datajunction-server
|
|
3
|
-
Version: 0.0.2.
|
|
3
|
+
Version: 0.0.2.dev3
|
|
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
|
{datajunction_server-0.0.2.dev2.dist-info → datajunction_server-0.0.2.dev3.dist-info}/RECORD
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
datajunction_server/__about__.py,sha256=
|
|
1
|
+
datajunction_server/__about__.py,sha256=u61zJrgdVNsCSa_Quk5oGQi6Kp6IA19UMD8utTcIY_E,54
|
|
2
2
|
datajunction_server/__init__.py,sha256=nN5-uJoSVEwuc8n-wMygqeF0Xhxi_zqqbCgutZvAt3E,384
|
|
3
3
|
datajunction_server/alembic.ini,sha256=mclJ_xx8pHfRyZ69SA9ZPqUwZaaQCTyxZ6wBmbrf1bo,3024
|
|
4
4
|
datajunction_server/config.py,sha256=L1zkaiF82S-ciR-wVeILx7CWKSOPPJ90a9zooXVNHEc,5641
|
|
@@ -185,7 +185,7 @@ datajunction_server/models/column.py,sha256=3TCa9dDAb9Q2WEAzpcdqAjKSX3PutbwlS8qG
|
|
|
185
185
|
datajunction_server/models/cube.py,sha256=p6KmqoOVGlziH5k0wXs6qBvgWWQs984Ho6SGplDbtAQ,4459
|
|
186
186
|
datajunction_server/models/cube_materialization.py,sha256=ydMRepDM95b4BBVay_nOYlRtK7OFG3pCDDTRdHe2awU,15787
|
|
187
187
|
datajunction_server/models/database.py,sha256=xhCllbq5ikFNnrPvzuchxQUC9RWogzh73Eqz7Jj0i38,499
|
|
188
|
-
datajunction_server/models/deployment.py,sha256=
|
|
188
|
+
datajunction_server/models/deployment.py,sha256=7z7JWfkpunpNLrnHAlP580OjmzsemOmLRU4y-SRXcqU,16003
|
|
189
189
|
datajunction_server/models/dialect.py,sha256=uifriawtKR4vi-GG2rdp4eeQkAkD6iLNuarCLQanTxY,3825
|
|
190
190
|
datajunction_server/models/dimensionlink.py,sha256=WaCarxhawOiQqtH1EVS0RQRu9D8Bx6GFonLsdSVgXSs,1551
|
|
191
191
|
datajunction_server/models/engine.py,sha256=Ebuy4HLkURr7mj0pxTj_Y4fEmF0oDen393rnj9fBnR0,466
|
|
@@ -226,7 +226,7 @@ datajunction_server/sql/parsing/backends/grammar/generated/SqlBaseParser.py,sha2
|
|
|
226
226
|
datajunction_server/sql/parsing/backends/grammar/generated/SqlBaseParser.tokens,sha256=JDrzbaKDwIaimAZPYIUzCgzkOEgq0X5-a6_lz78lqgs,8131
|
|
227
227
|
datajunction_server/sql/parsing/backends/grammar/generated/SqlBaseParserListener.py,sha256=vp8wduYkB-T5Xr6HZCSdzAxTHHPrDI5UJZXRJSVhAGA,102464
|
|
228
228
|
datajunction_server/sql/parsing/backends/grammar/generated/SqlBaseParserVisitor.py,sha256=w3V03LgPIHCiqojNyuekBDYqskjOKlKrd0sczQAB_WQ,60290
|
|
229
|
-
datajunction_server-0.0.2.
|
|
230
|
-
datajunction_server-0.0.2.
|
|
231
|
-
datajunction_server-0.0.2.
|
|
232
|
-
datajunction_server-0.0.2.
|
|
229
|
+
datajunction_server-0.0.2.dev3.dist-info/METADATA,sha256=LepJfcpcyl_-K2_6_pdLMUTX-PH_jKqaAK8rkdfRYI8,3769
|
|
230
|
+
datajunction_server-0.0.2.dev3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
231
|
+
datajunction_server-0.0.2.dev3.dist-info/entry_points.txt,sha256=MOInJGdcQ10bDEl-XW4UMokEgx-ypINqBhObeDI8KiQ,74
|
|
232
|
+
datajunction_server-0.0.2.dev3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|