continuo-python-runtime 0.14.0__py3-none-any.whl → 0.15.0__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.
- continuo_python_runtime/cli.py +23 -23
- continuo_python_runtime/contract/loader.py +11 -11
- continuo_python_runtime/contract/ontology_check.py +14 -14
- continuo_python_runtime/contract/pack.py +9 -9
- continuo_python_runtime/packages.py +1 -1
- continuo_python_runtime/validation/dependents_check.py +265 -0
- continuo_python_runtime/validation/probe_views.py +99 -0
- continuo_python_runtime/validation/runner.py +24 -22
- continuo_python_runtime/validation/warehouse_read.py +89 -0
- {continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/METADATA +41 -41
- {continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/RECORD +15 -13
- continuo_python_runtime/validation/preflight.py +0 -410
- {continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/WHEEL +0 -0
- {continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/entry_points.txt +0 -0
- {continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/licenses/LICENSE +0 -0
- {continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"""The ``probe_views`` validation op.
|
|
2
|
+
|
|
3
|
+
``probe_views`` tries each view of ``PROBE_VIEWS`` with a zero-row read and
|
|
4
|
+
reports which ones no longer bind, and never fails the op for a view that does
|
|
5
|
+
not. The block and the exit codes follow
|
|
6
|
+
:mod:`~continuo_python_runtime.validation.warehouse_read`: a failed probe or an
|
|
7
|
+
unreachable warehouse is exit 0, an input or adapter problem or an unexpected
|
|
8
|
+
error is exit 2.
|
|
9
|
+
"""
|
|
10
|
+
import logging
|
|
11
|
+
from collections.abc import Mapping
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from continuo_engine_contract.port import discover_adapter # type: ignore[import-untyped]
|
|
15
|
+
|
|
16
|
+
from continuo_python_runtime.validation.warehouse_read import (
|
|
17
|
+
Discover,
|
|
18
|
+
InputError,
|
|
19
|
+
close_quietly,
|
|
20
|
+
discover_and_check_env,
|
|
21
|
+
emit,
|
|
22
|
+
first_line,
|
|
23
|
+
json_list,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
logger = logging.getLogger("validation_probe_views")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _probe_views_input(env: Mapping[str, str]) -> list[tuple[str, str]]:
|
|
30
|
+
"""``PROBE_VIEWS`` as ``(schema, name)`` pairs, split on the first dot, each once, in order."""
|
|
31
|
+
pairs: list[tuple[str, str]] = []
|
|
32
|
+
for entry in json_list(env, "PROBE_VIEWS", required=True):
|
|
33
|
+
schema, dot, name = entry.partition(".")
|
|
34
|
+
if not dot or not schema or not name:
|
|
35
|
+
raise InputError(f"PROBE_VIEWS entry {entry!r} is not <schema>.<name>")
|
|
36
|
+
if (schema, name) not in pairs:
|
|
37
|
+
pairs.append((schema, name))
|
|
38
|
+
return pairs
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _quote(identifier: str) -> str:
|
|
42
|
+
return '"' + identifier.replace('"', '""') + '"'
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _finish_probe(
|
|
46
|
+
env: Mapping[str, str], status: str, message: str, reason: str, checked: bool,
|
|
47
|
+
views: list[dict[str, Any]],
|
|
48
|
+
) -> int:
|
|
49
|
+
node_id = env.get("NODE_ID") or "probe_views"
|
|
50
|
+
if status == "error":
|
|
51
|
+
logger.error("probe_views %s: %s", node_id, message)
|
|
52
|
+
elif reason:
|
|
53
|
+
logger.warning("probe_views %s: %s", node_id, message)
|
|
54
|
+
emit(status, message, node_id, reason, {"op": "probe_views", "checked": checked, "views": views})
|
|
55
|
+
return 2 if status == "error" else 0
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def run_probe_views(env: Mapping[str, str], discover: Discover = discover_adapter) -> int:
|
|
59
|
+
"""Run ``probe_views`` against *env*; print its one block and return the exit code.
|
|
60
|
+
|
|
61
|
+
Reads ``PROBE_VIEWS`` and the adapter's ``required_env()`` from *env*. A view
|
|
62
|
+
that fails its probe, or a warehouse that cannot be reached, still ends with
|
|
63
|
+
exit 0; only an input or adapter problem or an unexpected error is exit 2.
|
|
64
|
+
"""
|
|
65
|
+
try:
|
|
66
|
+
return _probe_views(env, discover)
|
|
67
|
+
except Exception as exc:
|
|
68
|
+
logger.exception("probe_views failed unexpectedly")
|
|
69
|
+
return _finish_probe(env, "error", f"unexpected error: {first_line(exc)}", "", False, [])
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _probe_views(env: Mapping[str, str], discover: Discover) -> int:
|
|
73
|
+
try:
|
|
74
|
+
pairs = _probe_views_input(env)
|
|
75
|
+
_, adapter_cls = discover_and_check_env(env, discover)
|
|
76
|
+
except InputError as exc:
|
|
77
|
+
return _finish_probe(env, "error", str(exc), "", False, [])
|
|
78
|
+
try:
|
|
79
|
+
adapter = adapter_cls.from_env()
|
|
80
|
+
except Exception as exc:
|
|
81
|
+
return _finish_probe(
|
|
82
|
+
env, "success", f"warehouse_unreachable: {first_line(exc)}", "warehouse_unreachable", False, []
|
|
83
|
+
)
|
|
84
|
+
views: list[dict[str, Any]] = []
|
|
85
|
+
try:
|
|
86
|
+
for schema, name in pairs:
|
|
87
|
+
error = ""
|
|
88
|
+
try:
|
|
89
|
+
adapter.fetch(f"SELECT * FROM {_quote(schema)}.{_quote(name)} LIMIT 0")
|
|
90
|
+
except Exception as exc:
|
|
91
|
+
error = first_line(exc)
|
|
92
|
+
views.append({"schema": schema, "name": name, "ok": not error, "error": error})
|
|
93
|
+
finally:
|
|
94
|
+
close_quietly(adapter)
|
|
95
|
+
broken = [f"{v['schema']}.{v['name']}" for v in views if not v["ok"]]
|
|
96
|
+
for name in broken:
|
|
97
|
+
logger.warning("probe_views: %s does not bind", name)
|
|
98
|
+
message = f"{len(broken)} of {len(views)} views failed: {', '.join(broken)}" if broken else ""
|
|
99
|
+
return _finish_probe(env, "success", message, "", True, views)
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Dispatches on ``VALIDATION_OP`` env var (default ``build_from_sql``):
|
|
4
4
|
- ``build_from_sql``: fetch the node's compiled SQL from S3 (``CANDIDATE_SQL_URI``) and
|
|
5
5
|
materialize it empty (models/snapshots).
|
|
6
|
-
- ``
|
|
6
|
+
- ``build_from_prod``: build the table empty, shaped like the prod table in ``PROD_SCHEMA``
|
|
7
7
|
(unchanged upstreams, including seeds).
|
|
8
8
|
- ``build_from_columns``: for python nodes, which have no SELECT to shape their output
|
|
9
9
|
from. Fetch the node's validation spec JSON from S3 (``CANDIDATE_SPEC_URI`` —
|
|
@@ -23,12 +23,12 @@ Dispatches on ``VALIDATION_OP`` env var (default ``build_from_sql``):
|
|
|
23
23
|
via the engine adapter and creates nothing — a test whose compiled SQL names
|
|
24
24
|
a column a candidate change dropped or renamed fails the release at its
|
|
25
25
|
source, before any table is built.
|
|
26
|
-
- ``
|
|
26
|
+
- ``dependents_check``: before a seed's production table is reloaded, list the objects
|
|
27
27
|
(``PROD_SCHEMA``.``TABLE_NAME``) that read it and compare them with the operator's
|
|
28
28
|
allowed and acknowledged lists. Needs no ``DBT_TARGET_SCHEMA`` and creates nothing.
|
|
29
29
|
- ``probe_views``: try each view of ``PROBE_VIEWS`` with a zero-row read and report
|
|
30
30
|
which ones no longer bind. Needs no ``DBT_TARGET_SCHEMA`` and creates nothing.
|
|
31
|
-
The inputs and the result block of
|
|
31
|
+
The inputs and the result block of each op are in its own module.
|
|
32
32
|
|
|
33
33
|
The engine adapter is discovered from the single installed
|
|
34
34
|
``continuo_engine.adapters`` entry point — each runner image installs exactly one.
|
|
@@ -49,7 +49,7 @@ from continuo_engine_contract.port import ( # type: ignore[import-untyped]
|
|
|
49
49
|
)
|
|
50
50
|
from continuo_python_runtime.csv_readers import reader_for
|
|
51
51
|
from continuo_python_runtime.csv_source import check_header, parse_csv_uri
|
|
52
|
-
from continuo_python_runtime.validation import
|
|
52
|
+
from continuo_python_runtime.validation import dependents_check, probe_views, s3
|
|
53
53
|
|
|
54
54
|
logger = logging.getLogger("validation_runner")
|
|
55
55
|
|
|
@@ -119,15 +119,15 @@ def load_candidate_spec() -> dict:
|
|
|
119
119
|
return spec
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
_NODE_OPS = ("build_from_sql", "
|
|
122
|
+
_NODE_OPS = ("build_from_sql", "build_from_prod", "build_from_columns", "check_binds")
|
|
123
123
|
_SCHEMA_OPS = ("ensure_schema", "drop_schema")
|
|
124
|
-
|
|
124
|
+
_WAREHOUSE_READ_OPS = ("dependents_check", "probe_views")
|
|
125
125
|
|
|
126
126
|
|
|
127
127
|
def main() -> None:
|
|
128
128
|
"""Run one validation op end to end; exits non-zero on failure.
|
|
129
129
|
|
|
130
|
-
Node ops (``build_from_sql``/``
|
|
130
|
+
Node ops (``build_from_sql``/``build_from_prod``/``build_from_columns``)
|
|
131
131
|
materialize one empty node table and require ``TABLE_NAME``. ``check_binds``
|
|
132
132
|
is also a node op and requires ``TABLE_NAME`` (for identity only, in the
|
|
133
133
|
result block's ``unique_id``) but creates nothing: it bind-checks a dbt
|
|
@@ -135,19 +135,27 @@ def main() -> None:
|
|
|
135
135
|
Schema ops (``ensure_schema``/``drop_schema``) act on the whole candidate
|
|
136
136
|
schema — the executor schedules them as one-shot engine-image Jobs to own
|
|
137
137
|
the candidate-schema lifecycle without connecting to the warehouse itself —
|
|
138
|
-
and take no table. The
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
and take no table. The warehouse-read ops (``dependents_check``/``probe_views``)
|
|
139
|
+
read the warehouse and change nothing; they read their own inputs, need no
|
|
140
|
+
candidate schema and exit with the code their own module's function
|
|
141
|
+
returns. An unknown op is refused before any input is read.
|
|
141
142
|
"""
|
|
142
143
|
logging.basicConfig(
|
|
143
144
|
level=logging.INFO, stream=sys.stderr, format="%(levelname)s %(name)s: %(message)s"
|
|
144
145
|
)
|
|
145
146
|
op = os.environ.get("VALIDATION_OP", "build_from_sql")
|
|
146
|
-
if op in
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
if op not in (*_NODE_OPS, *_SCHEMA_OPS, *_WAREHOUSE_READ_OPS):
|
|
148
|
+
target_schema = os.environ.get("DBT_TARGET_SCHEMA", "")
|
|
149
|
+
unique_id = _node_id() or (f"schema.{target_schema}" if target_schema else "")
|
|
150
|
+
logger.error("unknown VALIDATION_OP %r", op)
|
|
151
|
+
print(result.result_block("error", f"unknown VALIDATION_OP {op!r}",
|
|
152
|
+
unique_id=unique_id), flush=True)
|
|
153
|
+
sys.exit(2)
|
|
154
|
+
if op in _WAREHOUSE_READ_OPS:
|
|
155
|
+
if op == "dependents_check":
|
|
156
|
+
code = dependents_check.run_dependents_check(os.environ)
|
|
149
157
|
else:
|
|
150
|
-
code =
|
|
158
|
+
code = probe_views.run_probe_views(os.environ)
|
|
151
159
|
if code:
|
|
152
160
|
sys.exit(code)
|
|
153
161
|
return
|
|
@@ -222,14 +230,8 @@ def main() -> None:
|
|
|
222
230
|
sys.exit(2)
|
|
223
231
|
else:
|
|
224
232
|
prod_schema = _require("PROD_SCHEMA")
|
|
225
|
-
elif op in _SCHEMA_OPS:
|
|
226
|
-
unique_id = _node_id() or f"schema.{schema}"
|
|
227
233
|
else:
|
|
228
234
|
unique_id = _node_id() or f"schema.{schema}"
|
|
229
|
-
logger.error("unknown VALIDATION_OP %r", op)
|
|
230
|
-
print(result.result_block("error", f"unknown VALIDATION_OP {op!r}",
|
|
231
|
-
unique_id=unique_id), flush=True)
|
|
232
|
-
sys.exit(2)
|
|
233
235
|
|
|
234
236
|
# Engine selection is discovery, not configuration: the image installs one adapter.
|
|
235
237
|
try:
|
|
@@ -290,8 +292,8 @@ def main() -> None:
|
|
|
290
292
|
adapter.check_binds(read_sql)
|
|
291
293
|
adapter.build_empty_from_columns(schema, table, spec["output_columns"], config)
|
|
292
294
|
else:
|
|
293
|
-
assert prod_schema is not None, "prod_schema must be set for
|
|
294
|
-
adapter.
|
|
295
|
+
assert prod_schema is not None, "prod_schema must be set for build_from_prod"
|
|
296
|
+
adapter.build_empty_from_prod(schema, prod_schema, table)
|
|
295
297
|
except Exception as exc:
|
|
296
298
|
logger.error("ERROR op=%s on schema %s: %s", op, schema, exc)
|
|
297
299
|
print(result.result_block("error", str(exc), unique_id=unique_id), flush=True)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""What the warehouse-read validation ops share: their inputs, their one block and their adapter.
|
|
2
|
+
|
|
3
|
+
The ops ``dependents_check`` (:mod:`~continuo_python_runtime.validation.dependents_check`)
|
|
4
|
+
and ``probe_views`` (:mod:`~continuo_python_runtime.validation.probe_views`) read the
|
|
5
|
+
warehouse and change nothing. Each prints exactly one structured result block as
|
|
6
|
+
the last line on stdout (``continuo_engine_contract.result``) and returns the
|
|
7
|
+
process exit code: 0 when the op ran to its conclusion, 1 when a ``check`` stops,
|
|
8
|
+
2 when the op could not run (a bad input, no adapter, missing adapter env, an
|
|
9
|
+
unexpected error). The block's ``status`` is ``error`` for exit codes 1 and 2.
|
|
10
|
+
Diagnostics go to stderr through ``logging``; stdout carries only the block.
|
|
11
|
+
"""
|
|
12
|
+
import json
|
|
13
|
+
import logging
|
|
14
|
+
from collections.abc import Callable, Mapping
|
|
15
|
+
from typing import Any, cast
|
|
16
|
+
|
|
17
|
+
from continuo_engine_contract import result # type: ignore[import-untyped]
|
|
18
|
+
from continuo_engine_contract.port import ( # type: ignore[import-untyped]
|
|
19
|
+
AdapterDiscoveryError,
|
|
20
|
+
WarehouseAdapter,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger("validation_warehouse_read")
|
|
24
|
+
|
|
25
|
+
Discover = Callable[[], tuple[str, type[WarehouseAdapter]]]
|
|
26
|
+
|
|
27
|
+
# Longest driver text kept in a block; the first line only, so a block stays small.
|
|
28
|
+
MAX_TEXT = 500
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class InputError(Exception):
|
|
32
|
+
"""An input of the op is missing or malformed."""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def first_line(exc: BaseException) -> str:
|
|
36
|
+
"""The first line of an exception's text, at most ``MAX_TEXT`` characters, never empty."""
|
|
37
|
+
text = str(exc).strip()
|
|
38
|
+
line = text.splitlines()[0] if text else ""
|
|
39
|
+
return (line or type(exc).__name__)[:MAX_TEXT]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def json_list(env: Mapping[str, str], name: str, *, required: bool) -> list[str]:
|
|
43
|
+
"""The env var *name* as a JSON array of strings; unset or empty is ``[]`` unless *required*."""
|
|
44
|
+
raw = env.get(name, "")
|
|
45
|
+
if not raw.strip():
|
|
46
|
+
if required:
|
|
47
|
+
raise InputError(f"missing required env var {name}")
|
|
48
|
+
return []
|
|
49
|
+
try:
|
|
50
|
+
value = json.loads(raw)
|
|
51
|
+
except json.JSONDecodeError as exc:
|
|
52
|
+
raise InputError(f"{name} is not valid JSON: {exc}") from exc
|
|
53
|
+
if not isinstance(value, list) or not all(isinstance(item, str) for item in value):
|
|
54
|
+
raise InputError(f"{name} must be a JSON array of strings")
|
|
55
|
+
return cast(list[str], value)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def emit(
|
|
59
|
+
status: str, message: str, unique_id: str, reason: str, fields: dict[str, Any]
|
|
60
|
+
) -> None:
|
|
61
|
+
"""Print the op's one result block, the last line on stdout."""
|
|
62
|
+
print(
|
|
63
|
+
result.result_block(
|
|
64
|
+
status, message, 1 if status == "error" else 0, unique_id, reason=reason, fields=fields
|
|
65
|
+
),
|
|
66
|
+
flush=True,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def discover_and_check_env(
|
|
71
|
+
env: Mapping[str, str], discover: Discover
|
|
72
|
+
) -> tuple[str, type[WarehouseAdapter]]:
|
|
73
|
+
"""The installed adapter, after checking its required env is present in *env*."""
|
|
74
|
+
try:
|
|
75
|
+
engine, adapter_cls = discover()
|
|
76
|
+
except AdapterDiscoveryError as exc:
|
|
77
|
+
raise InputError(str(exc)) from exc
|
|
78
|
+
missing = [name for name in adapter_cls.required_env() if not env.get(name)]
|
|
79
|
+
if missing:
|
|
80
|
+
raise InputError(f"missing required env for engine {engine!r}: {', '.join(missing)}")
|
|
81
|
+
return engine, adapter_cls
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def close_quietly(adapter: Any) -> None:
|
|
85
|
+
"""Close the adapter; a failure only logs, so it never masks the op's outcome."""
|
|
86
|
+
try:
|
|
87
|
+
adapter.close()
|
|
88
|
+
except Exception as exc:
|
|
89
|
+
logger.error("adapter close failed: %s", exc)
|
{continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: continuo-python-runtime
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.15.0
|
|
4
4
|
Summary: Runtime harness, contract tooling, and CI lint for Continuo python nodes.
|
|
5
5
|
Author: Simone Carolini
|
|
6
6
|
Maintainer: Simone Carolini
|
|
@@ -12,8 +12,8 @@ Classifier: Intended Audience :: Developers
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.14
|
|
13
13
|
Requires-Python: >=3.14
|
|
14
14
|
Requires-Dist: boto3==1.43.114
|
|
15
|
-
Requires-Dist: continuo-contracts==0.
|
|
16
|
-
Requires-Dist: continuo-engine-contract==0.
|
|
15
|
+
Requires-Dist: continuo-contracts==0.5.0
|
|
16
|
+
Requires-Dist: continuo-engine-contract==0.11.0
|
|
17
17
|
Requires-Dist: pyarrow==26.0.0
|
|
18
18
|
Requires-Dist: pyyaml==6.0.3
|
|
19
19
|
Requires-Dist: sqlglot==30.23.0
|
|
@@ -76,7 +76,7 @@ separate validation-side port, adapter class, entry-point group or image: one
|
|
|
76
76
|
`WarehouseAdapter` per engine serves both the data plane (`fetch` /
|
|
77
77
|
`ensure_table` / `load`, plus the opt-in `table_columns` / `append` / `upsert`
|
|
78
78
|
capabilities) and validation (`ensure_schema` / `drop_schema` /
|
|
79
|
-
`build_empty_from_sql` / `build_empty_from_columns` / `
|
|
79
|
+
`build_empty_from_sql` / `build_empty_from_columns` / `build_empty_from_prod` /
|
|
80
80
|
`check_binds`), and one image per engine runs both roles.
|
|
81
81
|
|
|
82
82
|
| Package (distribution name) | Module | Lives in | Role |
|
|
@@ -115,7 +115,7 @@ last line of stdout, and Continuo's Go side parses it byte-for-byte
|
|
|
115
115
|
sentinel markers, the framing, and the field names inside the block — is
|
|
116
116
|
**frozen**. The additions are an optional `reason` key, written after
|
|
117
117
|
`unique_id` only when an outcome has a machine-readable code (for example
|
|
118
|
-
`image_contract_mismatch`), and the op's own keys that the `
|
|
118
|
+
`image_contract_mismatch`), and the op's own keys that the `dependents_check` and
|
|
119
119
|
`probe_views` ops write after `reason`; a block without either keeps its bytes,
|
|
120
120
|
and the sentinels, `schema_version` and the five standard keys do not change. Reuse
|
|
121
121
|
it; never change it from this side alone. A change here that
|
|
@@ -124,17 +124,17 @@ the Go parser has not been taught is a production outage, not a refactor.
|
|
|
124
124
|
## Quickstart for domain teams
|
|
125
125
|
|
|
126
126
|
1. Copy `template/` into a new repository.
|
|
127
|
-
2. Edit `template/.github/workflows/release.yml` and set `
|
|
128
|
-
|
|
127
|
+
2. Edit `template/.github/workflows/release.yml` and set `PROJECT` to the
|
|
128
|
+
name of the project this repository releases.
|
|
129
129
|
3. Configure repository variables in GitHub (Settings → Secrets and
|
|
130
130
|
variables → Actions): `REGISTRY` (your Docker registry), `BUCKET` (your
|
|
131
131
|
S3 bucket for the contract bundle), `RELEASE_ENDPOINT` (the base
|
|
132
132
|
URL of your continuo install, `scheme://host[:port]` with no path, the origin of continuo's
|
|
133
133
|
`auth.publicUrl`). The
|
|
134
134
|
workflow calls `<RELEASE_ENDPOINT>/api/v1/releases` with its GitHub Actions
|
|
135
|
-
OIDC token, so the repository must be bound to your
|
|
135
|
+
OIDC token, so the repository must be bound to your project in continuo's
|
|
136
136
|
`ciAuth.bindings` (see [Releasing from CI](https://github.com/carolsimone/continuo/blob/main/deploy/README.md#releasing-from-ci-github-actions)),
|
|
137
|
-
and an operator bootstraps the
|
|
137
|
+
and an operator bootstraps the project's first release.
|
|
138
138
|
4. Configure repository secrets: `AWS_ACCESS_KEY_ID` and
|
|
139
139
|
`AWS_SECRET_ACCESS_KEY` for the S3 upload. The template workflow pushes
|
|
140
140
|
the built image to GHCR using the workflow's own `GITHUB_TOKEN` (granted
|
|
@@ -150,13 +150,13 @@ the Go parser has not been taught is a production outage, not a refactor.
|
|
|
150
150
|
6. Push to `main`. The `release.yml` workflow lints the scripts, validates
|
|
151
151
|
the contracts, builds and pushes the image, packs the contracts into
|
|
152
152
|
`odcs-bundle.json`, uploads it to S3, and POSTs the release with
|
|
153
|
-
`"kind": "python
|
|
153
|
+
`"kind": "python"`.
|
|
154
154
|
|
|
155
155
|
## Contract files
|
|
156
156
|
|
|
157
157
|
Each node has one contract: an ODCS v3.2.0 data contract in `contracts/`,
|
|
158
158
|
named after its table, `<table>.odcs.yaml`, or `<schema>.<table>.odcs.yaml`
|
|
159
|
-
when two nodes of one
|
|
159
|
+
when two nodes of one project share a table name. The `continuo-contracts`
|
|
160
160
|
library reads each file strictly (YAML 1.2 core, with no aliases, no duplicate
|
|
161
161
|
keys and one document per file) and checks it. `validate`, `pack`, `hash` and
|
|
162
162
|
the harness load the folder the same way; the harness skips the read-query
|
|
@@ -196,9 +196,9 @@ schema:
|
|
|
196
196
|
- continuo's own settings are `customProperties` items with
|
|
197
197
|
`vendor: continuo`. Every node sets `schedule` and `criticality`
|
|
198
198
|
(`REGULATORY`, `CORE` or `SECONDARY`); the node's kind decides the rest
|
|
199
|
-
(see "Node kinds" below). An optional `
|
|
200
|
-
and `pack` and `validate --
|
|
201
|
-
their `--
|
|
199
|
+
(see "Node kinds" below). An optional `project` names the node's project,
|
|
200
|
+
and `pack` and `validate --project` refuse a contract whose `project` is not
|
|
201
|
+
their `--project`.
|
|
202
202
|
- A contract may also bind its table and its columns to the company's ontology
|
|
203
203
|
(see "Checking against the ontology" below).
|
|
204
204
|
- The contract has exactly one schema object, `physicalType: table`. Its
|
|
@@ -242,7 +242,7 @@ production. See `docs/boundary-contract.md` §13.1.
|
|
|
242
242
|
### Checking against the ontology
|
|
243
243
|
|
|
244
244
|
A company that keeps an ontology file, the things its data is about and the
|
|
245
|
-
|
|
245
|
+
projects that own them, can have each contract bind its table and its columns
|
|
246
246
|
to it. The bindings are optional `continuo` properties: `entity`, `grain`,
|
|
247
247
|
`fixed` and `filter` on the schema object, and `property`, `local` and
|
|
248
248
|
`aggregate` on a column (`docs/boundary-contract.md` gives their values):
|
|
@@ -272,10 +272,10 @@ A contract with bindings loads, validates, packs and runs like any other, and
|
|
|
272
272
|
its `content_hash` is the one it has without them. To check the bindings in your
|
|
273
273
|
CI, keep a copy of the company's ontology file in your own repository, for
|
|
274
274
|
example at `ontology/ontology.yaml`, and give `validate` the name of your
|
|
275
|
-
|
|
275
|
+
project and the path of that copy:
|
|
276
276
|
|
|
277
277
|
```bash
|
|
278
|
-
continuo-runtime validate contracts --
|
|
278
|
+
continuo-runtime validate contracts --project <name> --ontology ontology/ontology.yaml
|
|
279
279
|
```
|
|
280
280
|
|
|
281
281
|
Copy the file from the company's ontology repository, never from continuo, and
|
|
@@ -285,33 +285,33 @@ that is behind the ontology can pass here and still be refused by the release,
|
|
|
285
285
|
which checks against the ontology the install runs. The library's dbt check,
|
|
286
286
|
`continuo-contracts dbt check`, takes the same file with `--ontology`.
|
|
287
287
|
|
|
288
|
-
`--
|
|
289
|
-
|
|
290
|
-
both, every contract is checked as a contract of that
|
|
291
|
-
`continuo-contracts` that need no other
|
|
288
|
+
`--project` alone refuses a contract whose `project` property names another
|
|
289
|
+
project. `--ontology` needs `--project`; without it `validate` exits 2. With
|
|
290
|
+
both, every contract is checked as a contract of that project by the rules of
|
|
291
|
+
`continuo-contracts` that need no other project: `contract`, `coverage`,
|
|
292
292
|
`quality` and `privacy`. The rules that read the whole estate (`access`,
|
|
293
|
-
`order` and `drift`) cannot run on one
|
|
293
|
+
`order` and `drift`) cannot run on one project's contracts and are not run
|
|
294
294
|
here. `validate` logs, on stderr and at the level of its severity (ERROR,
|
|
295
295
|
WARNING or INFO), one line for each finding,
|
|
296
296
|
`<severity> [<rule>] <subject>: <message>`, then one INFO line that counts them,
|
|
297
297
|
`<e> error(s), <w> warning(s), <i> info: <name>`. It exits 1 when any finding is
|
|
298
298
|
an error and 0 otherwise, and it prints nothing to stdout.
|
|
299
299
|
|
|
300
|
-
- When the ontology declares the
|
|
300
|
+
- When the ontology declares the project, each contract names exactly one of
|
|
301
301
|
`entity` or `grain`, so a contract that names neither, or both, is an error.
|
|
302
302
|
A column that carries no binding is a warning, unless its name is a key part
|
|
303
303
|
or a property of the table's entity, in which case the check binds it itself.
|
|
304
|
-
- When the ontology does not declare the
|
|
304
|
+
- When the ontology does not declare the project, none of its contracts is
|
|
305
305
|
checked: `validate` logs one INFO line, `not declared in the ontology: none
|
|
306
|
-
of this
|
|
306
|
+
of this project's contracts is checked`, and one WARNING for each contract
|
|
307
307
|
that writes bindings, and exits 0.
|
|
308
308
|
- A file that cannot be read, is not UTF-8 text or is not an ontology is one
|
|
309
309
|
ERROR line, `<file>: <reason>`, and exit 1. The reason of an invalid
|
|
310
310
|
ontology is the library's, with the path to the first fault.
|
|
311
311
|
- A file that is an ontology but that the library's `ontology` rule refuses (a
|
|
312
|
-
thing owned by a domain the file does not declare, a
|
|
312
|
+
thing owned by a domain the file does not declare, a project of a domain it
|
|
313
313
|
does not declare, a personal property no access rule names) is refused the
|
|
314
|
-
same way, whatever the
|
|
314
|
+
same way, whatever the project, and no contract is checked against it: one
|
|
315
315
|
ERROR line, `<file>: the ontology file has <n> error(s): run
|
|
316
316
|
continuo-contracts ontology check <file>`, and exit 1. That command lists the
|
|
317
317
|
errors. Findings of that rule that are not errors do not stop the check.
|
|
@@ -554,11 +554,11 @@ A domain repo picks its warehouse engine by which base image it builds
|
|
|
554
554
|
`FROM`:
|
|
555
555
|
|
|
556
556
|
```dockerfile
|
|
557
|
-
FROM ghcr.io/carolsimone/continuo-python-runtime-postgres:v0.
|
|
557
|
+
FROM ghcr.io/carolsimone/continuo-python-runtime-postgres:v0.15.0
|
|
558
558
|
# or
|
|
559
|
-
FROM ghcr.io/carolsimone/continuo-python-runtime-trino:v0.
|
|
559
|
+
FROM ghcr.io/carolsimone/continuo-python-runtime-trino:v0.15.0
|
|
560
560
|
# or
|
|
561
|
-
FROM ghcr.io/carolsimone/continuo-python-runtime-duckdb:v0.
|
|
561
|
+
FROM ghcr.io/carolsimone/continuo-python-runtime-duckdb:v0.15.0
|
|
562
562
|
```
|
|
563
563
|
|
|
564
564
|
The engine is part of the image **name**; the tag is the bare version, so
|
|
@@ -571,7 +571,7 @@ repo's `adapters/postgres/`, `adapters/trino/` or `adapters/duckdb/` source
|
|
|
571
571
|
(see the table above) — registered under the
|
|
572
572
|
`continuo_engine.adapters` entry-point group (entry names `postgres` /
|
|
573
573
|
`trino` / `duckdb`). The runtime discovers it via `discover_adapter()` at run time, so a
|
|
574
|
-
single image serves every node in the
|
|
574
|
+
single image serves every node in the project and the release-time
|
|
575
575
|
validation Job for it. The executor injects the warehouse connection as
|
|
576
576
|
environment variables (engine-native, e.g.
|
|
577
577
|
`POSTGRES_HOST`/`POSTGRES_DB`/`POSTGRES_USER`) plus the node-selection
|
|
@@ -599,7 +599,7 @@ Both shapes end up running the same runtime and the same adapter version;
|
|
|
599
599
|
which one you pick only changes who controls the base OS layer underneath
|
|
600
600
|
them.
|
|
601
601
|
|
|
602
|
-
##
|
|
602
|
+
## Dependents check and view probe
|
|
603
603
|
|
|
604
604
|
Two validation ops read the warehouse and change nothing. They run through the
|
|
605
605
|
same runner image as the other validation ops (`VALIDATION_OP`), need no
|
|
@@ -610,32 +610,32 @@ a drop destroys the objects that read the table (`drop_semantics` `cascade`,
|
|
|
610
610
|
postgres) that takes every view, function and constraint built on the seed with
|
|
611
611
|
it, including objects continuo does not own. On an engine where those objects
|
|
612
612
|
survive and fail on their next read (`late_binding`, trino and duckdb) they
|
|
613
|
-
may go stale. `
|
|
613
|
+
may go stale. `dependents_check` lists what a reload would touch and compares it
|
|
614
614
|
with what the operator has allowed or acknowledged; `probe_views` tries named
|
|
615
615
|
views after a reload and says which no longer bind.
|
|
616
616
|
|
|
617
|
-
`
|
|
617
|
+
`dependents_check` runs in two places. `check` runs in the seed task's own pod just
|
|
618
618
|
before dbt and stops the reload with exit 1 when the check concludes it must.
|
|
619
619
|
`report` runs in the release's seed-build Job and only reports what a `check`
|
|
620
620
|
would conclude; it exits 0 whatever it finds.
|
|
621
621
|
|
|
622
|
-
### `
|
|
622
|
+
### `dependents_check` inputs
|
|
623
623
|
|
|
624
624
|
| Variable | Meaning |
|
|
625
625
|
|---|---|
|
|
626
|
-
| `
|
|
627
|
-
| `
|
|
626
|
+
| `DEPENDENTS_CHECK_MODE` | `check` or `report`. |
|
|
627
|
+
| `DEPENDENTS_CHECK_ENGINE_FAMILY` | `schema_bound` or `late_binding`, the family the release plan expects of the engine. |
|
|
628
628
|
| `PROD_SCHEMA`, `TABLE_NAME` | The seed's production relation. |
|
|
629
|
-
| `
|
|
629
|
+
| `DEPENDENTS_CHECK_ALLOWED`, `DEPENDENTS_CHECK_ACKNOWLEDGED` | JSON arrays of `"<schema>.<name>"`, default `[]`. An object is allowed when `<schema>.<name>`, in lower case, is in either list (entries are trimmed and lower-cased). |
|
|
630
630
|
| `NODE_ID` | Optional; the block's `unique_id`. Default `<PROD_SCHEMA>.<TABLE_NAME>`. |
|
|
631
631
|
|
|
632
632
|
The adapter's own variables (`POSTGRES_*`, `TRINO_*`, ...) are needed as for any
|
|
633
633
|
other op. An adapter's family is `schema_bound` when its `drop_semantics` is
|
|
634
634
|
`cascade`, and `late_binding` when it is `late_binding`.
|
|
635
635
|
|
|
636
|
-
### `
|
|
636
|
+
### `dependents_check` block
|
|
637
637
|
|
|
638
|
-
After the standard keys (and `reason` when one applies): `op` (`
|
|
638
|
+
After the standard keys (and `reason` when one applies): `op` (`dependents_check`),
|
|
639
639
|
`mode`, `checked` (the warehouse was asked and its listing came back), `engine_family` (as given),
|
|
640
640
|
`drop_semantics` (the adapter's), `completeness` (`exact`, `best_effort`, or
|
|
641
641
|
`none` when nothing was listed) and `dependents`, a list of
|
|
@@ -648,7 +648,7 @@ After the standard keys (and `reason` when one applies): `op` (`seed_preflight`)
|
|
|
648
648
|
| Situation | `reason` | `check` | `report` |
|
|
649
649
|
|---|---|---|---|
|
|
650
650
|
| a missing or malformed input, no adapter, missing adapter env | none | exit 2 | exit 2 |
|
|
651
|
-
| the adapter's family differs from `
|
|
651
|
+
| the adapter's family differs from `DEPENDENTS_CHECK_ENGINE_FAMILY`, or it declares none | `engine_mismatch` | exit 1 | exit 0 |
|
|
652
652
|
| the adapter cannot list dependents, `schema_bound` | `unowned_dependents` | exit 1 | exit 0 |
|
|
653
653
|
| the adapter cannot list dependents, `late_binding` | none | exit 0 | exit 0 |
|
|
654
654
|
| the connection fails | `warehouse_unreachable` | exit 1 | exit 0 |
|
{continuo_python_runtime-0.14.0.dist-info → continuo_python_runtime-0.15.0.dist-info}/RECORD
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
continuo_python_runtime/__init__.py,sha256=otNaXEPsTtRXJV5FLtDUsFO8VD4OC-MLAzwhtimHfOE,70
|
|
2
|
-
continuo_python_runtime/cli.py,sha256=
|
|
2
|
+
continuo_python_runtime/cli.py,sha256=SnU09GhAQnEjZd7zp428TTG360o0T8h5Ue4O2y0Tfyc,11331
|
|
3
3
|
continuo_python_runtime/closure.py,sha256=6e-IAQp8Lieb0bGKP1F6JE4TgVBJ_COTGXRUult2xeI,12991
|
|
4
4
|
continuo_python_runtime/conform.py,sha256=a9CKCA-gT9Zerzr6c5H8aByTFOUd6uBMo02sNKSDnXg,9199
|
|
5
5
|
continuo_python_runtime/content_check.py,sha256=FbngEt-lEwpfxO-qrhsDWXbBignmpP3ATLQ4hdkcWR4,2972
|
|
@@ -11,27 +11,29 @@ continuo_python_runtime/harness.py,sha256=CxDXcVcBWK3J70rwtzY_1ytucjFBThTfY3-9oO
|
|
|
11
11
|
continuo_python_runtime/hash_inputs.py,sha256=lKCiCFhfeE80o030JfjPosonEbr_4zWK7CsEgM_g0FM,2376
|
|
12
12
|
continuo_python_runtime/hashing.py,sha256=naBygHNmiPiJi6K6ZWBYdr21vw2ja_-A8qQF7vJ7iSs,3230
|
|
13
13
|
continuo_python_runtime/lint.py,sha256=Q8G-AOv6hx0d9hVXAJ5xpBvMZZpNaWRsoj9ES0NxsBg,21575
|
|
14
|
-
continuo_python_runtime/packages.py,sha256=
|
|
14
|
+
continuo_python_runtime/packages.py,sha256=gFeQ9WViJquRvH75GW5l769423uOFVx0Bpi-KfnM6qQ,2080
|
|
15
15
|
continuo_python_runtime/shape.py,sha256=C-5ClSxPYgoO9pUiGqw7pCnmlBbsEl-sIm7Twbf-H4o,3693
|
|
16
16
|
continuo_python_runtime/types.py,sha256=_ssxNE2Lq5782n9_Ihs-u_6ybCCy8XaL6iYbE35tBug,5057
|
|
17
17
|
continuo_python_runtime/contract/__init__.py,sha256=S79x6j_P0CmaSuCGzeWoK1U0507KvD2MZXwQl9DFWMM,37
|
|
18
18
|
continuo_python_runtime/contract/kinds.py,sha256=nGX1KdYgENzUETbc48V6ru7qU9K8dOUQ54N05ZRAwf0,6163
|
|
19
|
-
continuo_python_runtime/contract/loader.py,sha256
|
|
19
|
+
continuo_python_runtime/contract/loader.py,sha256=Ia5_1y5rGhGH3EV_kjxdMCDGfPZyP5e3ap5pOo4JVL8,14228
|
|
20
20
|
continuo_python_runtime/contract/model.py,sha256=NCjOZni6n9oEK0K2QyoQcu6D9snefqz1wx2l_M_RgKg,1754
|
|
21
|
-
continuo_python_runtime/contract/ontology_check.py,sha256=
|
|
22
|
-
continuo_python_runtime/contract/pack.py,sha256=
|
|
21
|
+
continuo_python_runtime/contract/ontology_check.py,sha256=7Bkc7SiboQWLo0TEB-zWhScFBllY3I_-XqPniAcKKbA,4150
|
|
22
|
+
continuo_python_runtime/contract/pack.py,sha256=_96tVlkebCNUfW6MXQIvL1aol-1guZwchUizv9UMxts,12926
|
|
23
23
|
continuo_python_runtime/contract/paths.py,sha256=uncZxz11Lfqom4eXFZeErU3dZUy8ShI9NpmiIJ20Abc,2804
|
|
24
24
|
continuo_python_runtime/contract/read_tables.py,sha256=bz3CHplIh9L3ecUuTudiu4D6y4aGcvdiTbopOkF5C2M,4036
|
|
25
25
|
continuo_python_runtime/csv_readers/__init__.py,sha256=9TKvjC37C77uRaJQZuO0--zVj2OvuNwpJE6nWx7j2S8,806
|
|
26
26
|
continuo_python_runtime/csv_readers/https.py,sha256=tMJ9k5F0b9SAydpon0ZlOznfjvjhF2BBLltyVmvRneE,4998
|
|
27
27
|
continuo_python_runtime/csv_readers/s3.py,sha256=zmvHs3TxlN2alPKrdaHzPyREmkve2nBiAsHRXXe1mE0,2246
|
|
28
28
|
continuo_python_runtime/validation/__init__.py,sha256=hz5oGXsoaUoygR0_pBby9PS6cEfrre518EE0HGB58eE,79
|
|
29
|
-
continuo_python_runtime/validation/
|
|
30
|
-
continuo_python_runtime/validation/
|
|
29
|
+
continuo_python_runtime/validation/dependents_check.py,sha256=E2HLy2N9RK4HZ2Btbov-QLuNidcBBWs5HzgGcvDDggw,10025
|
|
30
|
+
continuo_python_runtime/validation/probe_views.py,sha256=rFN6cImJ0hQ1mdjvR766NPIezQdf3FKNnt4rli7pdeQ,3897
|
|
31
|
+
continuo_python_runtime/validation/runner.py,sha256=Rzr1L-8t0Bxr8LuePZWug8gXqZtJ3KJAFeY8yleqgUI,15343
|
|
31
32
|
continuo_python_runtime/validation/s3.py,sha256=q8nRrT9R7L1-M4dSlDnkL7CUJMPmq86MHY_UKYFlEf8,1785
|
|
32
|
-
continuo_python_runtime
|
|
33
|
-
continuo_python_runtime-0.
|
|
34
|
-
continuo_python_runtime-0.
|
|
35
|
-
continuo_python_runtime-0.
|
|
36
|
-
continuo_python_runtime-0.
|
|
37
|
-
continuo_python_runtime-0.
|
|
33
|
+
continuo_python_runtime/validation/warehouse_read.py,sha256=2waLRnJHcO-L4n_-i_CtrNCWgr9MiZ49N-d3OOk0ZUc,3470
|
|
34
|
+
continuo_python_runtime-0.15.0.dist-info/METADATA,sha256=a8D6zXfu8kINdjcehlQRjt93y1Y3w_K_2PYLte8JpGA,39337
|
|
35
|
+
continuo_python_runtime-0.15.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
36
|
+
continuo_python_runtime-0.15.0.dist-info/entry_points.txt,sha256=ZvIwSm9f9B9ZmZMf6CyF5Zt4QONn8rqaIk-u-B1CF2Y,70
|
|
37
|
+
continuo_python_runtime-0.15.0.dist-info/licenses/LICENSE,sha256=hfXfFCk-8gnps4YvHA6bjCNaSYqOrq2gAdqkXYycAQc,11345
|
|
38
|
+
continuo_python_runtime-0.15.0.dist-info/licenses/NOTICE,sha256=ykgYyQkAMx3uas90FZHzt0aTca9IgJQCLpZ4d74Pl3U,465
|
|
39
|
+
continuo_python_runtime-0.15.0.dist-info/RECORD,,
|