continuo-postgres-adapter 0.4.0__tar.gz → 0.5.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.
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/PKG-INFO +3 -3
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/README.md +1 -1
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/continuo_postgres_adapter/adapter.py +5 -5
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/pyproject.toml +2 -2
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_adapter_postgres_validation.py +1 -1
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_integration_postgres_entrypoint.py +28 -20
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_integration_postgres_validation.py +3 -3
- continuo_postgres_adapter-0.4.0/tests/test_integration_postgres_seed_preflight.py → continuo_postgres_adapter-0.5.0/tests/test_integration_postgres_warehouse_read.py +6 -6
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_integration_runtime_postgres.py +37 -35
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/.gitignore +0 -0
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/continuo_postgres_adapter/__init__.py +0 -0
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/__init__.py +0 -0
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/conftest.py +0 -0
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_adapter_postgres_connect.py +0 -0
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_adapter_runtime_postgres.py +0 -0
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_integration_postgres_conformance.py +0 -0
- {continuo_postgres_adapter-0.4.0 → continuo_postgres_adapter-0.5.0}/tests/test_integration_postgres_dependents.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: continuo-postgres-adapter
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Postgres warehouse adapter for Continuo: validation and python-node runtime.
|
|
5
5
|
Author: Simone Carolini
|
|
6
6
|
Maintainer: Simone Carolini
|
|
@@ -8,7 +8,7 @@ Classifier: Development Status :: 4 - Beta
|
|
|
8
8
|
Classifier: Intended Audience :: Developers
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.14
|
|
10
10
|
Requires-Python: >=3.14
|
|
11
|
-
Requires-Dist: continuo-engine-contract==0.
|
|
11
|
+
Requires-Dist: continuo-engine-contract==0.11.0
|
|
12
12
|
Requires-Dist: psycopg2-binary==2.9.13
|
|
13
13
|
Requires-Dist: pyarrow==26.0.0
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
@@ -20,7 +20,7 @@ implements `continuo_engine_contract.port.WarehouseAdapter` (from the
|
|
|
20
20
|
`continuo-engine-contract` package) — one class covering both the data plane
|
|
21
21
|
(`fetch` / `ensure_table` / `load`) and release-time validation
|
|
22
22
|
(`ensure_schema` / `drop_schema` / `build_empty_from_sql` /
|
|
23
|
-
`build_empty_from_columns` / `
|
|
23
|
+
`build_empty_from_columns` / `build_empty_from_prod` / `check_binds`) — and
|
|
24
24
|
registers itself under entry-point group `continuo_engine.adapters` as
|
|
25
25
|
`postgres`.
|
|
26
26
|
|
|
@@ -5,7 +5,7 @@ implements `continuo_engine_contract.port.WarehouseAdapter` (from the
|
|
|
5
5
|
`continuo-engine-contract` package) — one class covering both the data plane
|
|
6
6
|
(`fetch` / `ensure_table` / `load`) and release-time validation
|
|
7
7
|
(`ensure_schema` / `drop_schema` / `build_empty_from_sql` /
|
|
8
|
-
`build_empty_from_columns` / `
|
|
8
|
+
`build_empty_from_columns` / `build_empty_from_prod` / `check_binds`) — and
|
|
9
9
|
registers itself under entry-point group `continuo_engine.adapters` as
|
|
10
10
|
`postgres`.
|
|
11
11
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
One class covers both roles Continuo asks of an engine:
|
|
4
4
|
|
|
5
5
|
* **Validation DDL** — ``ensure_schema``/``drop_schema`` manage the candidate
|
|
6
|
-
schema; empty builds go through ``CREATE TABLE … AS (…) WITH NO DATA``,
|
|
7
|
-
|
|
8
|
-
without scanning data. Schema creation is serialized on a session advisory
|
|
6
|
+
schema; empty builds go through ``CREATE TABLE … AS (…) WITH NO DATA``, an
|
|
7
|
+
empty build shaped like a production table through ``CTAS … WHERE 1=0``, and
|
|
8
|
+
``check_binds`` EXPLAINs a read without scanning data. Schema creation is serialized on a session advisory
|
|
9
9
|
lock because parallel root validation nodes race on ``CREATE SCHEMA``.
|
|
10
10
|
* **Python-node data-plane I/O** — ``fetch`` executes one declared read and
|
|
11
11
|
returns an Arrow table; ``ensure_table`` builds the table (an upsert key as
|
|
@@ -18,7 +18,7 @@ One class covers both roles Continuo asks of an engine:
|
|
|
18
18
|
The connection runs with ``autocommit = True``: every method owns its
|
|
19
19
|
transaction explicitly rather than relying on psycopg2's implicit
|
|
20
20
|
per-connection transaction. A single-statement method (``drop_schema``,
|
|
21
|
-
``build_empty_from_sql``, ``
|
|
21
|
+
``build_empty_from_sql``, ``build_empty_from_prod``) needs nothing further —
|
|
22
22
|
under autocommit each statement commits as it runs. A method that must apply
|
|
23
23
|
several statements atomically (``build_empty_from_columns``, ``check_binds``,
|
|
24
24
|
``ensure_table``, ``load``, ``append``, ``_upsert``) wraps them in its own explicit
|
|
@@ -692,7 +692,7 @@ class PostgresAdapter(WarehouseAdapter, AppendCapable, UpsertCapable, Dependents
|
|
|
692
692
|
)
|
|
693
693
|
)
|
|
694
694
|
|
|
695
|
-
def
|
|
695
|
+
def build_empty_from_prod(self, candidate_schema: str, prod_schema: str, table: str) -> None:
|
|
696
696
|
"""Create ``candidate_schema.table`` empty, shaped like ``prod_schema.table``."""
|
|
697
697
|
with self._conn.cursor() as cur:
|
|
698
698
|
cur.execute(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[project]
|
|
2
|
-
version = "0.
|
|
2
|
+
version = "0.5.0"
|
|
3
3
|
name = "continuo-postgres-adapter"
|
|
4
4
|
description = "Postgres warehouse adapter for Continuo: validation and python-node runtime."
|
|
5
5
|
authors = [{ name = "Simone Carolini" }]
|
|
@@ -12,7 +12,7 @@ dependencies = [
|
|
|
12
12
|
# of this adapter would otherwise accept whatever contract release is
|
|
13
13
|
# newest. This adapter subclasses the contract's WarehouseAdapter port
|
|
14
14
|
# directly, so the pair must stay the tested one.
|
|
15
|
-
"continuo-engine-contract==0.
|
|
15
|
+
"continuo-engine-contract==0.11.0",
|
|
16
16
|
"psycopg2-binary==2.9.13",
|
|
17
17
|
"pyarrow==26.0.0",
|
|
18
18
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Unit tests for the postgres adapter — mock-free.
|
|
2
2
|
|
|
3
|
-
DDL behavior (ensure_schema, drop_schema, build_empty_from_sql,
|
|
3
|
+
DDL behavior (ensure_schema, drop_schema, build_empty_from_sql, build_empty_from_prod,
|
|
4
4
|
the psycopg2 connection built by from_env, and DDL validity) is verified against a
|
|
5
5
|
live postgres engine in test_integration_postgres.py, not with mocked
|
|
6
6
|
cursors/connections here.
|
|
@@ -25,10 +25,11 @@ from pathlib import Path
|
|
|
25
25
|
|
|
26
26
|
import psycopg2
|
|
27
27
|
import pytest
|
|
28
|
-
import yaml
|
|
29
28
|
|
|
30
29
|
from continuo_engine_contract import result
|
|
31
|
-
from continuo_python_runtime.contract.
|
|
30
|
+
from continuo_python_runtime.contract.loader import load_contract_dir
|
|
31
|
+
from continuo_python_runtime.hash_inputs import gather_hash_inputs
|
|
32
|
+
from continuo_python_runtime.hashing import hash_parts
|
|
32
33
|
|
|
33
34
|
from .test_integration_postgres_conformance import PG
|
|
34
35
|
|
|
@@ -72,6 +73,13 @@ def _block(proc: subprocess.CompletedProcess) -> dict:
|
|
|
72
73
|
return json.loads(lines[1])
|
|
73
74
|
|
|
74
75
|
|
|
76
|
+
def _released_content_hash(repo: Path) -> str:
|
|
77
|
+
"""The content_hash the release records for the repository's only node, from its files as they are now."""
|
|
78
|
+
(node,) = load_contract_dir(repo / "contracts")
|
|
79
|
+
inputs = gather_hash_inputs(node, repo)
|
|
80
|
+
return hash_parts(node, inputs.primary, inputs.units)["content_hash"]
|
|
81
|
+
|
|
82
|
+
|
|
75
83
|
def _connect():
|
|
76
84
|
conn = psycopg2.connect(**PG)
|
|
77
85
|
conn.autocommit = True
|
|
@@ -118,29 +126,29 @@ def estate() -> Iterator[tuple[str, str]]:
|
|
|
118
126
|
|
|
119
127
|
def _seed_env(s: str, **extra: str) -> dict[str, str]:
|
|
120
128
|
return {
|
|
121
|
-
"VALIDATION_OP": "
|
|
122
|
-
"
|
|
123
|
-
"
|
|
129
|
+
"VALIDATION_OP": "dependents_check", "DEPENDENTS_CHECK_MODE": "check",
|
|
130
|
+
"DEPENDENTS_CHECK_ENGINE_FAMILY": "schema_bound", "PROD_SCHEMA": s, "TABLE_NAME": "seed",
|
|
131
|
+
"DEPENDENTS_CHECK_ALLOWED": json.dumps([f"{s}.v"]), **extra,
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
|
|
127
|
-
def
|
|
135
|
+
def test_dependents_check_stops_on_a_view_outside_the_allowed_set(estate):
|
|
128
136
|
s, b = estate
|
|
129
137
|
proc = _entrypoint("validation-op", _seed_env(s))
|
|
130
138
|
block = _block(proc)
|
|
131
139
|
assert proc.returncode == 1
|
|
132
|
-
assert (block["status"], block["reason"], block["op"]) == ("error", "unowned_dependents", "
|
|
140
|
+
assert (block["status"], block["reason"], block["op"]) == ("error", "unowned_dependents", "dependents_check")
|
|
133
141
|
assert block["failures"] == 1 and block["checked"] is True and block["completeness"] == "exact"
|
|
134
142
|
assert {(d["schema"], d["name"], d["allowed"]) for d in block["dependents"]} == {(s, "v", True), (b, "bi_v", False)}
|
|
135
143
|
assert "unowned_dependents" in proc.stderr
|
|
136
144
|
|
|
137
145
|
|
|
138
|
-
def
|
|
146
|
+
def test_dependents_check_passes_once_the_view_is_acknowledged(estate):
|
|
139
147
|
s, b = estate
|
|
140
|
-
proc = _entrypoint("validation-op", _seed_env(s,
|
|
148
|
+
proc = _entrypoint("validation-op", _seed_env(s, DEPENDENTS_CHECK_ACKNOWLEDGED=json.dumps([f"{b}.bi_v"])))
|
|
141
149
|
block = _block(proc)
|
|
142
150
|
assert proc.returncode == 0
|
|
143
|
-
assert (block["status"], block["op"], block["failures"]) == ("success", "
|
|
151
|
+
assert (block["status"], block["op"], block["failures"]) == ("success", "dependents_check", 0)
|
|
144
152
|
assert "reason" not in block and all(d["allowed"] for d in block["dependents"])
|
|
145
153
|
|
|
146
154
|
|
|
@@ -157,7 +165,7 @@ def test_probe_views_reports_a_view_that_cannot_be_read_and_exits_0(estate):
|
|
|
157
165
|
|
|
158
166
|
|
|
159
167
|
@pytest.mark.parametrize("env,op", [
|
|
160
|
-
({"VALIDATION_OP": "
|
|
168
|
+
({"VALIDATION_OP": "dependents_check", "DEPENDENTS_CHECK_MODE": "drop"}, "dependents_check"),
|
|
161
169
|
({"VALIDATION_OP": "probe_views", "PROBE_VIEWS": '"bi.x"'}, "probe_views"),
|
|
162
170
|
])
|
|
163
171
|
def test_a_bad_input_exits_2_and_the_process_does_not_ask_for_a_candidate_schema(env, op):
|
|
@@ -172,18 +180,18 @@ def test_a_bad_input_exits_2_and_the_process_does_not_ask_for_a_candidate_schema
|
|
|
172
180
|
assert block["message"] in proc.stderr
|
|
173
181
|
|
|
174
182
|
|
|
175
|
-
def test_the_harness_refuses_an_image_that_differs_from_the_release_and_writes_nothing(tmp_path: Path):
|
|
176
|
-
(tmp_path / "contracts").mkdir()
|
|
183
|
+
def test_the_harness_refuses_an_image_that_differs_from_the_release_and_writes_nothing(tmp_path: Path, write_contract):
|
|
177
184
|
(tmp_path / "scripts").mkdir()
|
|
178
185
|
script = tmp_path / "scripts" / "t.py"
|
|
179
186
|
script.write_text("def run(ctx):\n return ctx.read('ids')\n")
|
|
180
|
-
(
|
|
181
|
-
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
write_contract(
|
|
188
|
+
tmp_path / "contracts",
|
|
189
|
+
schema="analytics", table="t", owner="m", schedule="daily",
|
|
190
|
+
criticality="SECONDARY", script="scripts/t.py",
|
|
191
|
+
reads={"ids": "select id from analytics.a"},
|
|
192
|
+
output_columns=[{"name": "id", "type": "INTEGER", "nullable": False}],
|
|
193
|
+
)
|
|
194
|
+
released = _released_content_hash(tmp_path)
|
|
187
195
|
script.write_text("def run(ctx):\n return ctx.read('ids') # edited after the release\n")
|
|
188
196
|
target = f"ep_{uuid.uuid4().hex[:10]}"
|
|
189
197
|
env = {
|
|
@@ -92,11 +92,11 @@ def test_build_empty_from_sql_live(prod_table):
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
@pytest.mark.integration
|
|
95
|
-
def
|
|
96
|
-
"""
|
|
95
|
+
def test_build_empty_from_prod_live(prod_table):
|
|
96
|
+
"""Build an empty candidate table shaped like the prod table."""
|
|
97
97
|
a = PostgresAdapter(_conn())
|
|
98
98
|
a.ensure_schema("_candidate_it")
|
|
99
|
-
a.
|
|
99
|
+
a.build_empty_from_prod("_candidate_it", "prod_it", "src_table")
|
|
100
100
|
a.close()
|
|
101
101
|
assert _columns("_candidate_it", "src_table") == [("id", "integer"), ("name", "text")]
|
|
102
102
|
assert _count("_candidate_it", "src_table") == 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""``
|
|
1
|
+
"""``dependents_check`` and ``probe_views`` against postgres:16 (tests/smoke/postgres-stack).
|
|
2
2
|
|
|
3
3
|
Run the stack first:
|
|
4
4
|
docker compose -f tests/smoke/postgres-stack/docker-compose.yml up -d --wait
|
|
@@ -20,7 +20,7 @@ import pytest
|
|
|
20
20
|
from continuo_engine_contract import result
|
|
21
21
|
from continuo_postgres_adapter import adapter as adapter_module
|
|
22
22
|
from continuo_postgres_adapter.adapter import PostgresAdapter
|
|
23
|
-
from continuo_python_runtime.validation import
|
|
23
|
+
from continuo_python_runtime.validation import dependents_check, probe_views
|
|
24
24
|
|
|
25
25
|
from .test_integration_postgres_conformance import PG
|
|
26
26
|
|
|
@@ -68,7 +68,7 @@ def estate(monkeypatch) -> Iterator[tuple[str, str]]:
|
|
|
68
68
|
|
|
69
69
|
def _run(op, **env):
|
|
70
70
|
out = io.StringIO()
|
|
71
|
-
run =
|
|
71
|
+
run = dependents_check.run_dependents_check if op == "dependents_check" else probe_views.run_probe_views
|
|
72
72
|
with contextlib.redirect_stdout(out):
|
|
73
73
|
code = run({**os.environ, **env}, discover=lambda: ("postgres", PostgresAdapter))
|
|
74
74
|
lines = out.getvalue().splitlines()
|
|
@@ -78,9 +78,9 @@ def _run(op, **env):
|
|
|
78
78
|
|
|
79
79
|
def _seed(s, mode="check", table="seed", allowed=(), acknowledged=(), **env):
|
|
80
80
|
return _run(
|
|
81
|
-
"
|
|
82
|
-
PROD_SCHEMA=s, TABLE_NAME=table,
|
|
83
|
-
|
|
81
|
+
"dependents_check", DEPENDENTS_CHECK_MODE=mode, DEPENDENTS_CHECK_ENGINE_FAMILY="schema_bound",
|
|
82
|
+
PROD_SCHEMA=s, TABLE_NAME=table, DEPENDENTS_CHECK_ALLOWED=json.dumps(list(allowed)),
|
|
83
|
+
DEPENDENTS_CHECK_ACKNOWLEDGED=json.dumps(list(acknowledged)), **env,
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
|
|
@@ -12,7 +12,6 @@ import boto3
|
|
|
12
12
|
import psycopg2
|
|
13
13
|
import pyarrow as pa
|
|
14
14
|
import pytest
|
|
15
|
-
import yaml
|
|
16
15
|
|
|
17
16
|
from continuo_python_runtime.harness import run_node
|
|
18
17
|
from continuo_postgres_adapter.adapter import PostgresAdapter
|
|
@@ -360,23 +359,23 @@ def csv_minio(minio_container):
|
|
|
360
359
|
return endpoint
|
|
361
360
|
|
|
362
361
|
|
|
363
|
-
def _csv_contract_dir(tmp_path, schema):
|
|
362
|
+
def _csv_contract_dir(write_contract, tmp_path, schema):
|
|
364
363
|
"""A contract dir with a single python-csv node reading s3://pg-drops/orders.csv."""
|
|
365
|
-
(
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
364
|
+
write_contract(
|
|
365
|
+
tmp_path / "contracts",
|
|
366
|
+
schema=schema, table="orders_csv", owner="m", schedule="daily",
|
|
367
|
+
criticality="SECONDARY", kind="python-csv",
|
|
368
|
+
reads={"csv": "s3://pg-drops/orders.csv"},
|
|
369
|
+
output_columns=[
|
|
371
370
|
{"name": "order_id", "type": "INTEGER", "nullable": False},
|
|
372
371
|
{"name": "amount", "type": "DOUBLE PRECISION"},
|
|
373
372
|
],
|
|
374
|
-
|
|
373
|
+
)
|
|
375
374
|
return tmp_path
|
|
376
375
|
|
|
377
376
|
|
|
378
377
|
@pytest.mark.integration
|
|
379
|
-
def test_run_node_csv_kind_loads_minio_csv_into_postgres(clean_schema, csv_minio, monkeypatch, tmp_path):
|
|
378
|
+
def test_run_node_csv_kind_loads_minio_csv_into_postgres(clean_schema, csv_minio, monkeypatch, tmp_path, write_contract):
|
|
380
379
|
"""run_node on a python-csv node fetches from real minio and writes to real postgres.
|
|
381
380
|
|
|
382
381
|
Exercises the full production path added in this task: harness.run_node
|
|
@@ -387,7 +386,7 @@ def test_run_node_csv_kind_loads_minio_csv_into_postgres(clean_schema, csv_minio
|
|
|
387
386
|
for a python-node node.
|
|
388
387
|
"""
|
|
389
388
|
monkeypatch.setenv("S3_ENDPOINT_URL", csv_minio)
|
|
390
|
-
repo = _csv_contract_dir(tmp_path, clean_schema)
|
|
389
|
+
repo = _csv_contract_dir(write_contract, tmp_path, clean_schema)
|
|
391
390
|
env = {
|
|
392
391
|
"NODE_ID": f"python-csv.svc.{clean_schema}.orders_csv",
|
|
393
392
|
"TABLE_NAME": "orders_csv",
|
|
@@ -436,33 +435,36 @@ _FX_SCRIPT = (
|
|
|
436
435
|
)
|
|
437
436
|
|
|
438
437
|
|
|
439
|
-
|
|
440
|
-
|
|
438
|
+
@pytest.fixture()
|
|
439
|
+
def fx_run_env(write_contract):
|
|
440
|
+
"""Build the env of a python-api fx node returning *rows*, with a script file unique to *run*.
|
|
441
441
|
|
|
442
442
|
One file per run: rewriting the same file within a second at the same size
|
|
443
443
|
would let Python reuse its cached bytecode and return the previous rows.
|
|
444
444
|
"""
|
|
445
|
-
(repo
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
445
|
+
def build(repo, schema, run, rows, **mode):
|
|
446
|
+
(repo / "scripts").mkdir(exist_ok=True)
|
|
447
|
+
script = f"scripts/fx_{run}.py"
|
|
448
|
+
(repo / script).write_text(_FX_SCRIPT.format(rows=rows))
|
|
449
|
+
write_contract(
|
|
450
|
+
repo / "contracts",
|
|
451
|
+
schema=schema, table="fx_rates", owner="m", schedule="hourly",
|
|
452
|
+
criticality="SECONDARY", kind="python-api", script=script,
|
|
453
|
+
output_columns=_FX_COLUMNS, **mode,
|
|
454
|
+
)
|
|
455
|
+
return {
|
|
456
|
+
"NODE_ID": f"python-api.svc.{schema}.fx_rates", "TABLE_NAME": "fx_rates",
|
|
457
|
+
"TARGET_SCHEMA": schema, "CONTRACT_DIR": str(repo / "contracts"), "APP_ROOT": str(repo),
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
return build
|
|
459
461
|
|
|
460
462
|
|
|
461
463
|
@pytest.mark.integration
|
|
462
|
-
def test_run_node_append_keeps_the_rows_of_earlier_runs(clean_schema, tmp_path):
|
|
463
|
-
env =
|
|
464
|
+
def test_run_node_append_keeps_the_rows_of_earlier_runs(clean_schema, tmp_path, fx_run_env):
|
|
465
|
+
env = fx_run_env(tmp_path, clean_schema, "run1", [("2026-10-08", "EUR", "1.081200")], mode_type="append")
|
|
464
466
|
assert run_node(env, adapter=_adapter()) == 0
|
|
465
|
-
env =
|
|
467
|
+
env = fx_run_env(
|
|
466
468
|
tmp_path, clean_schema, "run2",
|
|
467
469
|
[("2026-10-08", "EUR", "1.081200"), ("2026-10-09", "EUR", "1.090000")],
|
|
468
470
|
mode_type="append",
|
|
@@ -472,15 +474,15 @@ def test_run_node_append_keeps_the_rows_of_earlier_runs(clean_schema, tmp_path):
|
|
|
472
474
|
|
|
473
475
|
|
|
474
476
|
@pytest.mark.integration
|
|
475
|
-
def test_run_node_upsert_overwrites_by_key_and_keeps_the_constraint(clean_schema, tmp_path):
|
|
477
|
+
def test_run_node_upsert_overwrites_by_key_and_keeps_the_constraint(clean_schema, tmp_path, fx_run_env):
|
|
476
478
|
"""Review Focus 4 and 5 through the whole harness."""
|
|
477
479
|
key = {"mode_type": "upsert", "primary_key": ["rate_date", "base"]}
|
|
478
|
-
env =
|
|
480
|
+
env = fx_run_env(
|
|
479
481
|
tmp_path, clean_schema, "run1",
|
|
480
482
|
[("2026-10-08", "EUR", "1.081200"), ("2026-10-08", "GBP", "0.861000")], **key,
|
|
481
483
|
)
|
|
482
484
|
assert run_node(env, adapter=_adapter()) == 0
|
|
483
|
-
env =
|
|
485
|
+
env = fx_run_env(
|
|
484
486
|
tmp_path, clean_schema, "run2",
|
|
485
487
|
[("2026-10-08", "EUR", "1.090000"), ("2026-10-09", "EUR", "1.100000")], **key,
|
|
486
488
|
)
|
|
@@ -511,9 +513,9 @@ def test_run_node_upsert_overwrites_by_key_and_keeps_the_constraint(clean_schema
|
|
|
511
513
|
|
|
512
514
|
|
|
513
515
|
@pytest.mark.integration
|
|
514
|
-
def test_run_node_append_into_a_drifted_table_fails_naming_the_column(clean_schema, tmp_path, capsys):
|
|
516
|
+
def test_run_node_append_into_a_drifted_table_fails_naming_the_column(clean_schema, tmp_path, capsys, fx_run_env):
|
|
515
517
|
_seed(clean_schema, "fx_rates", "rate_date date NOT NULL, base varchar(3) NOT NULL", "")
|
|
516
|
-
env =
|
|
518
|
+
env = fx_run_env(tmp_path, clean_schema, "run1", [("2026-10-08", "EUR", "1.081200")], mode_type="append")
|
|
517
519
|
assert run_node(env, adapter=_adapter()) == 1
|
|
518
520
|
out = capsys.readouterr().out
|
|
519
521
|
assert '"message":"LoadError: table runtime_it.fx_rates does not match' in out
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|