datajunction-server 0.0.2.dev0__py3-none-any.whl → 0.0.2.dev2__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.
@@ -2,4 +2,4 @@
2
2
  Version for Hatch
3
3
  """
4
4
 
5
- __version__ = "0.0.2.dev0"
5
+ __version__ = "0.0.2.dev2"
@@ -432,7 +432,7 @@ async def export_namespace_spec(
432
432
  namespace,
433
433
  )
434
434
  link.join_on = inject_prefixes(link.join_on, namespace)
435
- else:
435
+ else: # pragma: no cover
436
436
  link.dimension = inject_prefixes(link.dimension, namespace)
437
437
  if node_spec.node_type == NodeType.CUBE:
438
438
  cube_spec = cast(CubeSpec, node_spec)
@@ -44,11 +44,11 @@ class Deployment(Base):
44
44
 
45
45
  @property
46
46
  def deployment_spec(self) -> DeploymentSpec:
47
- return DeploymentSpec(**self.spec)
47
+ return DeploymentSpec(**self.spec) # pragma: no cover
48
48
 
49
49
  @deployment_spec.setter
50
50
  def deployment_spec(self, value: DeploymentSpec):
51
- self.spec = value.dict()
51
+ self.spec = value.dict() # pragma: no cover
52
52
 
53
53
  @property
54
54
  def deployment_results(self) -> list[DeploymentResult]:
@@ -56,4 +56,4 @@ class Deployment(Base):
56
56
 
57
57
  @deployment_results.setter
58
58
  def deployment_results(self, value: list[DeploymentResult]):
59
- self.results = [result.dict() for result in value]
59
+ self.results = [result.dict() for result in value] # pragma: no cover
@@ -56,8 +56,8 @@ class ColumnSpec(BaseModel):
56
56
  partition: PartitionSpec | None = None
57
57
 
58
58
  def __eq__(self, other: Any) -> bool:
59
- # if not isinstance(other, ColumnSpec):
60
- # return False
59
+ if not isinstance(other, ColumnSpec):
60
+ return False
61
61
 
62
62
  return (
63
63
  self.name == other.name
@@ -65,7 +65,7 @@ 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) or (self.partition is None and other.partition is None)
69
69
  )
70
70
 
71
71
 
@@ -163,18 +163,9 @@ class DimensionReferenceLinkSpec(DimensionLinkSpec):
163
163
  def dimension_attribute(self) -> str:
164
164
  return self.dimension.rsplit(".", 1)[-1]
165
165
 
166
- # def __hash__(self) -> int:
167
- # return hash(
168
- # (
169
- # self.rendered_dimension_node,
170
- # self.dimension_attribute,
171
- # self.node_column,
172
- # ),
173
- # )
174
-
175
166
  def __eq__(self, other: Any) -> bool:
176
- # if not isinstance(other, DimensionReferenceLinkSpec):
177
- # return False
167
+ if not isinstance(other, DimensionReferenceLinkSpec):
168
+ return False
178
169
  return (
179
170
  super().__eq__(other)
180
171
  and self.rendered_dimension_node == other.rendered_dimension_node
@@ -224,10 +215,9 @@ class NodeSpec(BaseModel):
224
215
 
225
216
  @property
226
217
  def rendered_query(self) -> str | None:
227
- if hasattr(self, "query"):
218
+ if hasattr(self, "query") and self.query:
228
219
  query = getattr(self, "query")
229
- if query:
230
- return render_prefixes(query, self.namespace)
220
+ return render_prefixes(query, self.namespace)
231
221
  return None
232
222
 
233
223
  @property
@@ -242,8 +232,8 @@ class NodeSpec(BaseModel):
242
232
  return self._query_ast
243
233
 
244
234
  def __eq__(self, other: Any) -> bool:
245
- # if not isinstance(other, NodeSpec):
246
- # return False
235
+ if not isinstance(other, NodeSpec):
236
+ return False
247
237
  return (
248
238
  self.rendered_name == other.rendered_name
249
239
  and self.node_type == other.node_type
@@ -397,11 +387,11 @@ class MetricSpec(NodeSpec):
397
387
  super().__eq__(other)
398
388
  and self.query_ast.compare(other.query_ast)
399
389
  and (self.required_dimensions or []) == (other.required_dimensions or [])
400
- and self.direction == other.direction
401
- and self.unit == other.unit
402
- and self.significant_digits == other.significant_digits
403
- and self.min_decimal_exponent == other.min_decimal_exponent
404
- and self.max_decimal_exponent == other.max_decimal_exponent
390
+ and (self.direction == other.direction) or (self.direction is None and other.direction is None)
391
+ and (self.unit == other.unit) or (self.unit is None and other.unit is None)
392
+ and (self.significant_digits == other.significant_digits) or (self.significant_digits is None and other.significant_digits is None)
393
+ and (self.min_decimal_exponent == other.min_decimal_exponent) or (self.min_decimal_exponent is None and other.min_decimal_exponent is None)
394
+ and (self.max_decimal_exponent == other.max_decimal_exponent) or (self.max_decimal_exponent is None and other.max_decimal_exponent is None)
405
395
  )
406
396
 
407
397
 
@@ -431,12 +421,25 @@ class CubeSpec(NodeSpec):
431
421
  ]
432
422
 
433
423
  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
+ )
434
437
  return (
435
438
  super().__eq__(other)
436
439
  and (
437
440
  (self.columns or []) == (other.columns or [])
438
441
  or (
439
- self.columns is None
442
+ not self.columns
440
443
  and not any(
441
444
  [attr for attr in col.attributes if attr != "primary_key"]
442
445
  for col in other.columns
@@ -480,7 +483,7 @@ class DeploymentSpec(BaseModel):
480
483
  "metric": MetricSpec,
481
484
  "cube": CubeSpec,
482
485
  }
483
- if node_type not in mapping:
486
+ if node_type not in mapping: # pragma: no cover
484
487
  raise ValueError(f"Unknown node_type: {node_type}")
485
488
  deployment_ns = values.get("namespace")
486
489
  return mapping[node_type](**value, namespace=deployment_ns)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: datajunction-server
3
- Version: 0.0.2.dev0
3
+ Version: 0.0.2.dev2
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
@@ -1,4 +1,4 @@
1
- datajunction_server/__about__.py,sha256=35Ts5XaNX5Ex0ZdaT8GTOPfw-qaO0d_arUCBPdNiQ5I,54
1
+ datajunction_server/__about__.py,sha256=kVl_34fkA7KY3Y1J_D8v00tuvI2dTjfSCc1549SHP7g,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
@@ -65,7 +65,7 @@ datajunction_server/api/main.py,sha256=s1gWNs5wGXzCtlqf4faeq-rE6uf_RLn4O7WJnauWr
65
65
  datajunction_server/api/materializations.py,sha256=buhYWTUGBbRI0fWvREaK1D1F809y5eSxHDWqTQtBewc,21796
66
66
  datajunction_server/api/measures.py,sha256=MdNpB4iNqEcU5-hWno5X4QnMTbijc2ISrprS8nyY2WQ,5729
67
67
  datajunction_server/api/metrics.py,sha256=X5By7oNWa9b0l65Qf8Bcz--aClngc30y4G3PMdJhTCs,4917
68
- datajunction_server/api/namespaces.py,sha256=48LfIa1RDHc0ql9mrLPLBcCAPAbmxd-rZbM3WbOKRZ8,14829
68
+ datajunction_server/api/namespaces.py,sha256=S-j5JNWzwKh52SgML6pTbgF-dbFzPUvn1r9x3oPWIhw,14849
69
69
  datajunction_server/api/nodes.py,sha256=0nOPEKD0OQ8Tq5FLElKI2ODnXRZS25jM9yUywURKfsc,43728
70
70
  datajunction_server/api/notifications.py,sha256=0jHnWD6leBxazVgZtfTlL1e8-sZ3Y2PmU8FI-TWepkU,5403
71
71
  datajunction_server/api/setup_logging.py,sha256=_1LlR2KMqjjBff1gqJ8Kmyvza1dAYjzGGK6kak1GdcU,174
@@ -120,7 +120,7 @@ datajunction_server/database/catalog.py,sha256=44jhu_2RMFMiYwuz87vP9GvOW3oAwEdUt
120
120
  datajunction_server/database/collection.py,sha256=i27roD2CL1P7-7WBXgWbt5ReZ6gxPoqJbRFCkJQtLEg,2873
121
121
  datajunction_server/database/column.py,sha256=SRN_uz2FwejEMI83mv8-3LXFUUI1-4IqcH9sb5qiFc8,6044
122
122
  datajunction_server/database/database.py,sha256=iwfLuVaEs2nlPidBDfJJGJrVGy1eTrcm6_-z1UFQCRI,3650
123
- datajunction_server/database/deployment.py,sha256=hSXeXZWIRJBhYCw6ORoQN-lQ0AKSOevc8KVXK9JSsNo,2084
123
+ datajunction_server/database/deployment.py,sha256=cSakZPFeF0xrrpVSlfe3Vyd2zjuc2CXRq5fAnyEA9O8,2144
124
124
  datajunction_server/database/dimensionlink.py,sha256=cuAMIGsBgZf7CBcNM1D-bV4nOyLkyi7nGUlNU21LH6w,7401
125
125
  datajunction_server/database/engine.py,sha256=c4mCfvMKZDNMm1vrSlkRtylx8pynbkTFAvWp5SJT568,1656
126
126
  datajunction_server/database/history.py,sha256=hxGRQdvxwKLy8acRAFd1XgS7M-Wl3RpVT1krlC4rhuU,1899
@@ -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=2d6ylqVT_570I6q3oTgFwnQnD7tSZxND-Qf9tgxpu_E,15718
188
+ datajunction_server/models/deployment.py,sha256=AgVd2o1dSYtWzpqR3R61-Hja0OVWk_sExh408Gx4iOo,16631
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.dev0.dist-info/METADATA,sha256=3pde6UgXgiAsUfKJ_Jru8CU6tdnp9Tww2MflidLeVj4,3769
230
- datajunction_server-0.0.2.dev0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
231
- datajunction_server-0.0.2.dev0.dist-info/entry_points.txt,sha256=MOInJGdcQ10bDEl-XW4UMokEgx-ypINqBhObeDI8KiQ,74
232
- datajunction_server-0.0.2.dev0.dist-info/RECORD,,
229
+ datajunction_server-0.0.2.dev2.dist-info/METADATA,sha256=1nsSX_VKvu5SkHpIuXNFyBudwMZRwU_1mF6AuDaTFhc,3769
230
+ datajunction_server-0.0.2.dev2.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
231
+ datajunction_server-0.0.2.dev2.dist-info/entry_points.txt,sha256=MOInJGdcQ10bDEl-XW4UMokEgx-ypINqBhObeDI8KiQ,74
232
+ datajunction_server-0.0.2.dev2.dist-info/RECORD,,