query-cache-common 1.2.0__tar.gz → 1.2.1__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 (21) hide show
  1. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/.gitignore +3 -0
  2. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/PKG-INFO +2 -1
  3. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/pyproject.toml +1 -0
  4. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/services/explain_service_models.py +4 -0
  5. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/utils.py +15 -0
  6. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/__init__.py +0 -0
  7. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/auth.py +0 -0
  8. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/constants.py +0 -0
  9. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/decorators.py +0 -0
  10. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/__init__.py +0 -0
  11. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/_typing.py +0 -0
  12. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/base.py +0 -0
  13. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/converters.py +0 -0
  14. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/fields.py +0 -0
  15. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/services/__init__.py +0 -0
  16. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/services/client_telemetry_service_models.py +0 -0
  17. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/services/client_validation_service_models.py +0 -0
  18. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/services/clone_service_models.py +0 -0
  19. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/services/execution_service_models.py +0 -0
  20. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/services/sql_service_models.py +0 -0
  21. {query_cache_common-1.2.0 → query_cache_common-1.2.1}/src/query_cache_common/models/shared_models.py +0 -0
@@ -226,3 +226,6 @@ tests/integration/dbt_run_cache_turbo/corpus_catalog.json
226
226
 
227
227
  # Superpowers (AI agent plans/specs)
228
228
  docs/superpowers/
229
+
230
+ # Git worktrees
231
+ .worktrees/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: query-cache-common
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary: Common code for Query Cache shared across client and server
5
5
  License: Copyright (c) 2026 Fivetran, Inc.
6
6
 
@@ -32,5 +32,6 @@ License: Copyright (c) 2026 Fivetran, Inc.
32
32
  FROM USE OF THIS SOFTWARE, INCLUDING DIRECT, INDIRECT, INCIDENTAL,
33
33
  PUNITIVE, AND CONSEQUENTIAL DAMAGES.
34
34
  Requires-Python: >=3.9
35
+ Requires-Dist: humanize
35
36
  Requires-Dist: query-cache-protobuf
36
37
  Requires-Dist: typing-extensions>=4.0.0
@@ -7,6 +7,7 @@ requires-python = ">=3.9"
7
7
  dependencies = [
8
8
  "typing-extensions>=4.0.0",
9
9
  "query-cache-protobuf",
10
+ "humanize",
10
11
  ]
11
12
 
12
13
  [tool.hatch.version]
@@ -57,3 +57,7 @@ class GetExplainMessagesRequest(BaseSerDeModel):
57
57
  @proto_dataclass(explain_service_pb2.GetExplainMessagesResponse)
58
58
  class GetExplainMessagesResponse(BaseSerDeModel):
59
59
  messages: t.List[ExplainMessageEntry]
60
+
61
+ @property
62
+ def by_id(self) -> t.Dict[str, ExplainMessageEntry]:
63
+ return {m.execution_decision_id: m for m in self.messages}
@@ -1,5 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import datetime
4
+ import humanize
3
5
  import time
4
6
  import typing as t
5
7
 
@@ -114,3 +116,16 @@ def extract_fqn_parts(fqn: str, dialect: str) -> t.Tuple[str, str, str]:
114
116
  raise ValueError(f"Expecting SQLGlot expression for name, got: {name}")
115
117
 
116
118
  return catalog.sql(dialect=dialect), schema.sql(dialect=dialect), name.sql(dialect=dialect)
119
+
120
+
121
+ def format_as_localtime(dt: datetime.datetime) -> str:
122
+ local_dt = dt.astimezone() # convert to localtime
123
+ return local_dt.strftime("%Y-%m-%d %H:%M:%S %Z")
124
+
125
+
126
+ def format_epoch_relative(epoch: t.Optional[int]) -> str:
127
+ if epoch is None:
128
+ return "no data"
129
+
130
+ as_dt = datetime.datetime.fromtimestamp(epoch / 1000, tz=datetime.timezone.utc)
131
+ return f"{humanize.naturaltime(as_dt)}, {format_as_localtime(as_dt)}"