query-cache-common 1.20.0__tar.gz → 1.22.0__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.
Files changed (22) hide show
  1. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/PKG-INFO +1 -1
  2. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/auth.py +1 -2
  3. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/decorators.py +7 -7
  4. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/base.py +1 -2
  5. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/converters.py +1 -1
  6. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/fields.py +0 -1
  7. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/client_telemetry_service_models.py +5 -6
  8. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/clone_service_models.py +2 -1
  9. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/execution_service_models.py +17 -2
  10. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/explain_service_models.py +2 -1
  11. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/sql_service_models.py +2 -1
  12. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/state_selector_service_models.py +4 -3
  13. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/shared_models.py +4 -2
  14. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/utils.py +3 -1
  15. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/.gitignore +0 -0
  16. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/pyproject.toml +0 -0
  17. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/__init__.py +0 -0
  18. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/constants.py +0 -0
  19. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/__init__.py +0 -0
  20. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/_typing.py +0 -0
  21. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/__init__.py +0 -0
  22. {query_cache_common-1.20.0 → query_cache_common-1.22.0}/src/query_cache_common/models/services/client_validation_service_models.py +1 -1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: query-cache-common
3
- Version: 1.20.0
3
+ Version: 1.22.0
4
4
  Summary: Common code for Query Cache shared across client and server
5
5
  License:
6
6
  Apache License
@@ -3,7 +3,6 @@ from __future__ import annotations
3
3
  import typing as t
4
4
  from functools import cached_property
5
5
 
6
-
7
6
  RUNCACHE_ORG_SCOPE_PREFIX = "runcache:scope:org"
8
7
  LEGACY_ORG_SCOPE_PREFIX = "conway:scope:org"
9
8
  ORG_SCOPE_PREFIXES = (RUNCACHE_ORG_SCOPE_PREFIX, LEGACY_ORG_SCOPE_PREFIX)
@@ -67,7 +66,7 @@ class Scope:
67
66
  raise ValueError(f"Only one organization scope is supported, got multiple: {org_ids}.")
68
67
  org_id = org_ids[0]
69
68
  if org_id == "*":
70
- raise ValueError(f"Wildcard organization ID is not allowed.")
69
+ raise ValueError("Wildcard organization ID is not allowed.")
71
70
  return org_id
72
71
 
73
72
  @cached_property
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import enum
4
4
  import typing as t
5
- from dataclasses import fields, Field, dataclass
5
+ from dataclasses import Field, dataclass, fields
6
6
 
7
7
  from google.protobuf.message import Message
8
8
  from typing_extensions import dataclass_transform
@@ -38,7 +38,7 @@ class FieldInfo:
38
38
  def create_inner_field_info(self) -> FieldInfo:
39
39
  return FieldInfo(
40
40
  name=self.name,
41
- field_type=[x for x in self.inner_types if x is not type(None)][0],
41
+ field_type=next(x for x in self.inner_types if x is not type(None)),
42
42
  proto_converter={},
43
43
  )
44
44
 
@@ -321,15 +321,15 @@ def _create_enum_from_proto_method(
321
321
  """Convert protobuf enum value to Python enum instance."""
322
322
  try:
323
323
  return from_proto_map[proto_value]
324
- except KeyError:
324
+ except KeyError as e:
325
325
  if hasattr(cls_inner, "_UNSUPPORTED"):
326
- return cls_inner._UNSUPPORTED # ty: ignore[invalid-return-type]
326
+ return cls_inner._UNSUPPORTED # ty: ignore[invalid-return-type] # noqa: SLF001
327
327
  valid_values = sorted(from_proto_map.keys())
328
328
  proto_enum_name = getattr(proto_enum_cls, "_enum_type", proto_enum_cls).name # ty: ignore[unresolved-attribute]
329
329
  raise ValueError(
330
330
  f"Invalid proto enum value {proto_value} for {proto_enum_name}. "
331
331
  f"Valid values: {valid_values}"
332
- )
332
+ ) from e
333
333
 
334
334
  return classmethod(from_proto_func)
335
335
 
@@ -348,10 +348,10 @@ def _generate_enum_to_proto_method(
348
348
  """Convert Python enum instance to protobuf enum value."""
349
349
  try:
350
350
  return to_proto_map[self]
351
- except KeyError:
351
+ except KeyError as e:
352
352
  raise ValueError(
353
353
  f"Invalid enum instance {self} for conversion to proto. "
354
354
  f"This indicates a bug in the proto_enum decorator."
355
- )
355
+ ) from e
356
356
 
357
357
  return to_proto_func
@@ -5,7 +5,6 @@ import json
5
5
  import typing as t
6
6
  from dataclasses import dataclass, fields
7
7
 
8
-
9
8
  BSDM = t.TypeVar("BSDM", bound="BaseSerDeModel")
10
9
  BSDE = t.TypeVar("BSDE", bound="BaseSerDeEnum")
11
10
 
@@ -69,7 +68,7 @@ def _deserialize_field_value(
69
68
  args = t.get_args(field_type)
70
69
 
71
70
  if args and type(None) in args:
72
- field_type = [arg for arg in args if arg is not type(None)][0]
71
+ field_type = next(arg for arg in args if arg is not type(None))
73
72
 
74
73
  if hasattr(field_type, "from_dict"):
75
74
  return field_type.from_dict(value) # ty: ignore[call-non-callable]
@@ -3,8 +3,8 @@ from __future__ import annotations
3
3
  import typing as t
4
4
  from datetime import timedelta
5
5
 
6
- from query_cache_protobuf.query_cache.struct_pb2 import ListValue, Struct, Value, NULL_VALUE
7
6
  from google.protobuf.duration_pb2 import Duration
7
+ from query_cache_protobuf.query_cache.struct_pb2 import NULL_VALUE, ListValue, Struct, Value
8
8
 
9
9
  if t.TYPE_CHECKING:
10
10
  from google.protobuf.internal.containers import MessageMap
@@ -1,7 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import typing as t
4
-
5
4
  from dataclasses import field
6
5
 
7
6
 
@@ -1,20 +1,19 @@
1
1
  from __future__ import annotations
2
2
 
3
- from dataclasses import field
4
-
5
-
6
3
  import typing as t
4
+ from dataclasses import field
7
5
  from datetime import timedelta
8
6
 
7
+ from query_cache_protobuf.query_cache.services import client_telemetry_service_pb2
8
+
9
9
  from query_cache_common.decorators import proto_dataclass, proto_enum
10
- from query_cache_common.models.base import BaseSerDeModel, BaseSerDeEnum
10
+ from query_cache_common.models.base import BaseSerDeEnum, BaseSerDeModel
11
11
  from query_cache_common.models.converters import (
12
- struct_to_dict,
13
12
  dict_to_struct,
14
13
  duration_to_timedelta,
14
+ struct_to_dict,
15
15
  timedelta_to_duration,
16
16
  )
17
- from query_cache_protobuf.query_cache.services import client_telemetry_service_pb2
18
17
 
19
18
 
20
19
  @proto_dataclass(client_telemetry_service_pb2.SessionStartRequest)
@@ -3,6 +3,8 @@ from __future__ import annotations
3
3
  import typing as t
4
4
  from dataclasses import field
5
5
 
6
+ from query_cache_protobuf.query_cache.services import clone_service_pb2
7
+
6
8
  from query_cache_common.decorators import proto_dataclass
7
9
  from query_cache_common.models import shared_models
8
10
  from query_cache_common.models._typing import TransformedNodesByQuery
@@ -11,7 +13,6 @@ from query_cache_common.models.converters import dict_to_struct, struct_to_dict
11
13
  from query_cache_common.models.fields import (
12
14
  transformed_nodes_by_query_field,
13
15
  )
14
- from query_cache_protobuf.query_cache.services import clone_service_pb2
15
16
 
16
17
 
17
18
  @proto_dataclass(clone_service_pb2.TableProperties)
@@ -3,12 +3,13 @@ from __future__ import annotations
3
3
  import typing as t
4
4
  from dataclasses import field
5
5
 
6
+ from query_cache_protobuf.query_cache.services import execution_service_pb2
7
+
6
8
  from query_cache_common.decorators import proto_dataclass
7
9
  from query_cache_common.models import shared_models
8
- from query_cache_common.models.services import sql_service_models
9
10
  from query_cache_common.models.base import BaseSerDeModel
10
11
  from query_cache_common.models.converters import dict_to_struct, struct_to_dict
11
- from query_cache_protobuf.query_cache.services import execution_service_pb2
12
+ from query_cache_common.models.services import sql_service_models
12
13
 
13
14
 
14
15
  @proto_dataclass(execution_service_pb2.ConfirmExecutionRequest)
@@ -126,3 +127,17 @@ class RecordExecutionsRequest(BaseSerDeModel):
126
127
  @proto_dataclass(execution_service_pb2.RecordExecutionsResponse)
127
128
  class RecordExecutionsResponse(BaseSerDeModel):
128
129
  records_stored: int = 0
130
+
131
+
132
+ @proto_dataclass(execution_service_pb2.ResolveDeferredRelationsRequest)
133
+ class ResolveDeferredRelationsRequest(BaseSerDeModel):
134
+ profile_name: str
135
+ target_name: str
136
+ project_name: str
137
+ project_id: t.Optional[str] = None
138
+ node_unique_ids: t.List[str] = field(default_factory=list)
139
+
140
+
141
+ @proto_dataclass(execution_service_pb2.ResolveDeferredRelationsResponse)
142
+ class ResolveDeferredRelationsResponse(BaseSerDeModel):
143
+ fqn_by_unique_id: t.Dict[str, str] = field(default_factory=dict)
@@ -3,10 +3,11 @@ from __future__ import annotations
3
3
  import typing as t
4
4
  from dataclasses import field
5
5
 
6
+ from query_cache_protobuf.query_cache.services import explain_service_pb2
7
+
6
8
  from query_cache_common.decorators import proto_dataclass, proto_enum
7
9
  from query_cache_common.models.base import BaseSerDeEnum, BaseSerDeModel
8
10
  from query_cache_common.models.shared_models import SubmitSQLResultType
9
- from query_cache_protobuf.query_cache.services import explain_service_pb2
10
11
 
11
12
 
12
13
  @proto_enum(explain_service_pb2.ExplainMarker)
@@ -3,6 +3,8 @@ from __future__ import annotations
3
3
  import typing as t
4
4
  from dataclasses import field
5
5
 
6
+ from query_cache_protobuf.query_cache.services import sql_service_pb2
7
+
6
8
  from query_cache_common.decorators import proto_dataclass
7
9
  from query_cache_common.models import shared_models
8
10
  from query_cache_common.models._typing import TransformedNodesByQuery
@@ -12,7 +14,6 @@ from query_cache_common.models.fields import (
12
14
  transformed_nodes_by_query_field,
13
15
  )
14
16
  from query_cache_common.models.services.clone_service_models import TableProperties
15
- from query_cache_protobuf.query_cache.services import sql_service_pb2
16
17
 
17
18
 
18
19
  @proto_dataclass(sql_service_pb2.SubmitValuesRequest)
@@ -1,12 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import typing as t
4
- from query_cache_common.decorators import proto_dataclass, proto_enum
5
- from query_cache_common.models import shared_models
6
- from query_cache_common.models.base import BaseSerDeModel, BaseSerDeEnum
7
4
 
8
5
  from query_cache_protobuf.query_cache.services import state_selector_service_pb2
9
6
 
7
+ from query_cache_common.decorators import proto_dataclass, proto_enum
8
+ from query_cache_common.models import shared_models
9
+ from query_cache_common.models.base import BaseSerDeEnum, BaseSerDeModel
10
+
10
11
 
11
12
  @proto_dataclass(state_selector_service_pb2.StateSelectorRequest)
12
13
  class StateSelectorRequest(BaseSerDeModel):
@@ -2,10 +2,11 @@ from __future__ import annotations
2
2
 
3
3
  import typing as t
4
4
 
5
- from query_cache_common.decorators import proto_dataclass, proto_enum
6
- from query_cache_common.models.base import BaseSerDeModel, BaseSerDeEnum
7
5
  from query_cache_protobuf.query_cache import shared_pb2
8
6
 
7
+ from query_cache_common.decorators import proto_dataclass, proto_enum
8
+ from query_cache_common.models.base import BaseSerDeEnum, BaseSerDeModel
9
+
9
10
 
10
11
  @proto_enum(shared_pb2.ModelExecutionType)
11
12
  class ModelExecutionType(BaseSerDeEnum):
@@ -118,3 +119,4 @@ class DbtNodeState(BaseSerDeModel):
118
119
  node_contract_hash: t.Optional[str] = None
119
120
  node_persisted_descriptions_hash: t.Optional[str] = None
120
121
  project_id: t.Optional[str] = None
122
+ node_database_representation: t.Optional[str] = None
@@ -1,14 +1,16 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import datetime
4
- import humanize
5
4
  import time
6
5
  import typing as t
7
6
 
7
+ import humanize
8
8
 
9
9
  if t.TYPE_CHECKING:
10
10
  from sqlglot.expressions import (
11
11
  Create as CreateStatement,
12
+ )
13
+ from sqlglot.expressions import (
12
14
  Expression as SqlglotExpression,
13
15
  )
14
16
 
@@ -1,9 +1,9 @@
1
1
  from __future__ import annotations
2
2
 
3
+ from query_cache_protobuf.query_cache.services import client_validation_service_pb2
3
4
 
4
5
  from query_cache_common.decorators import proto_dataclass
5
6
  from query_cache_common.models.base import BaseSerDeModel
6
- from query_cache_protobuf.query_cache.services import client_validation_service_pb2
7
7
 
8
8
 
9
9
  @proto_dataclass(client_validation_service_pb2.ValidateClientVersionRequest)