dbt-metricflow-sql 0.3.0__tar.gz → 0.3.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.
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/PKG-INFO +1 -1
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/pyproject.toml +1 -1
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/sl_config.py +27 -2
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/.gitignore +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/LICENSE +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/PYPI.md +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/README.md +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/__init__.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/cli.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/client.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/dependencies.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/docs.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/fragment.schema.json +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/llms-full.txt +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/plugin.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/semantics.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/server.py +0 -0
- {dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/uv.lock +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dbt-metricflow-sql"
|
|
3
3
|
# A placeholder: a release sets its tag's version, with scripts/set_version.py.
|
|
4
|
-
version = "0.3.
|
|
4
|
+
version = "0.3.1"
|
|
5
5
|
description = "dbt v1 plugin for MetricFlow"
|
|
6
6
|
# Its PyPI page: README.md is for this repository.
|
|
7
7
|
readme = "PYPI.md"
|
|
@@ -23,6 +23,10 @@ dbt Cloud answers its Semantic Layer routes 404 alike when the account's
|
|
|
23
23
|
`experimental-semantic-layer` flag is off, the token lacks a permission, or the account doesn't
|
|
24
24
|
exist; and, for up to an hour after the flag is switched on, from servers that don't see it yet,
|
|
25
25
|
before any handler runs, so without effect. A 404 is retried for `--retry-for` seconds.
|
|
26
|
+
|
|
27
|
+
A 502, 503 or 504, from a gateway whose backend is starting or briefly gone, is retried for a
|
|
28
|
+
short while too, but only for a GET, PUT or DELETE: those are safe to repeat, while a POST's may
|
|
29
|
+
already have created what it sent. Running a `create` again is safe either way, with `--if-missing`.
|
|
26
30
|
"""
|
|
27
31
|
|
|
28
32
|
from __future__ import annotations
|
|
@@ -80,6 +84,11 @@ _DIGITS = re.compile(r"[0-9]+")
|
|
|
80
84
|
_DEFAULT_RETRY_SECONDS = 120.0
|
|
81
85
|
_FIRST_RETRY_DELAY_SECONDS = 0.5
|
|
82
86
|
_MAX_RETRY_DELAY_SECONDS = 8.0
|
|
87
|
+
# A gateway's answers when its backend is starting, gone, or slow: worth a few retries.
|
|
88
|
+
_TRANSIENT_STATUSES = frozenset({502, 503, 504})
|
|
89
|
+
# Methods whose request can be repeated without effect, so retrying a transient failure is safe.
|
|
90
|
+
_IDEMPOTENT_METHODS = frozenset({"GET", "HEAD", "PUT", "DELETE"})
|
|
91
|
+
_TRANSIENT_RETRY_SECONDS = 30.0
|
|
83
92
|
_TIMEOUT_SECONDS = 30
|
|
84
93
|
_PAGE_SIZE = 100
|
|
85
94
|
|
|
@@ -449,19 +458,35 @@ class _Api:
|
|
|
449
458
|
not_found: ConfigError,
|
|
450
459
|
retry_for: float,
|
|
451
460
|
) -> Any:
|
|
452
|
-
"""
|
|
461
|
+
"""
|
|
462
|
+
The JSON answer, retrying a 404 until `retry_for` runs out, then raising `not_found`, and
|
|
463
|
+
an idempotent request's transient failure for `_TRANSIENT_RETRY_SECONDS`.
|
|
464
|
+
"""
|
|
453
465
|
what = f"{method} {urllib.parse.urlsplit(url).path}"
|
|
454
466
|
data = None if body is None else json.dumps(body).encode()
|
|
455
467
|
request_headers = {**headers, "Accept": "application/json"}
|
|
456
468
|
if data is not None:
|
|
457
469
|
request_headers["Content-Type"] = "application/json"
|
|
458
|
-
|
|
470
|
+
start = time.monotonic()
|
|
471
|
+
deadline = start + retry_for
|
|
472
|
+
transient_deadline = start + _TRANSIENT_RETRY_SECONDS
|
|
459
473
|
delay = _FIRST_RETRY_DELAY_SECONDS
|
|
460
474
|
while True:
|
|
461
475
|
request = urllib.request.Request(url, data=data, headers=request_headers, method=method)
|
|
462
476
|
status, payload = _send(request)
|
|
463
477
|
if 200 <= status < 300:
|
|
464
478
|
return payload
|
|
479
|
+
if (
|
|
480
|
+
status in _TRANSIENT_STATUSES
|
|
481
|
+
and method in _IDEMPOTENT_METHODS
|
|
482
|
+
and time.monotonic() + delay <= transient_deadline
|
|
483
|
+
):
|
|
484
|
+
print(
|
|
485
|
+
f"MetricFlow: {what} answered {status}; retrying in {delay:g}s", file=sys.stderr
|
|
486
|
+
)
|
|
487
|
+
time.sleep(delay)
|
|
488
|
+
delay = min(delay * 2, _MAX_RETRY_DELAY_SECONDS)
|
|
489
|
+
continue
|
|
465
490
|
if status == 404 and time.monotonic() + delay > deadline:
|
|
466
491
|
raise not_found
|
|
467
492
|
if status != 404:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/dependencies.py
RENAMED
|
File without changes
|
|
File without changes
|
{dbt_metricflow_sql-0.3.0 → dbt_metricflow_sql-0.3.1}/src/dbt_metricflow_sql/fragment.schema.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|