Skip to content

Commit 50a0020

Browse files
committed
[RegulatoryArea] create new flow
1 parent 82dd582 commit 50a0020

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pipeline/src/queries/cross/cacem/regulatory_areas_hashes.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SELECT
33
md5(
44
COALESCE(geom::text, '') ||
55
COALESCE(ref_reg::text, '') ||
6-
COALESCE(date_modif::text, '') ||
6+
COALESCE(date_modif::text, '')
77
) AS cacem_row_hash
88
FROM prod.reg_cacem
99
WHERE

pipeline/tests/test_flows/test_regulatory_areas.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pandas as pd
2-
from pipeline.src.flows.regulatory_areas import load_new_regulatory_areas, update_regulatory_areas, flow
2+
from pipeline.src.flows.regulatory_areas import load_new_regulatory_areas, regulatory_areas_flow, update_regulatory_areas, flow
33
import prefect
44
import pytest
55
from src.read_query import read_query
@@ -59,8 +59,9 @@ def test_load_new_regulatory_areas(reset_test_data, new_regulatory_areas):
5959
FROM public.regulatory_areas
6060
ORDER BY id"""
6161
)
62+
6263
expectedRegulations = pd.concat([old_regulations, new_regulatory_areas], ignore_index=True)
63-
load_new_regulatory_areas.run(new_regulatory_areas)
64+
load_new_regulatory_areas(new_regulatory_areas)
6465
loaded_regulations = read_query(
6566
"monitorenv_remote",
6667
"""SELECT
@@ -71,8 +72,8 @@ def test_load_new_regulatory_areas(reset_test_data, new_regulatory_areas):
7172
pd.testing.assert_frame_equal(loaded_regulations, expectedRegulations)
7273

7374

74-
def test_update_new_regulations(reset_test_data, regulatory_areas_to_update):
75-
update_regulatory_areas.run(regulatory_areas_to_update)
75+
def test_update_new_regulatory_areas(reset_test_data, regulatory_areas_to_update):
76+
update_regulatory_areas(regulatory_areas_to_update)
7677
updated_regulations = read_query(
7778
"monitorenv_remote",
7879
"""SELECT
@@ -83,6 +84,6 @@ def test_update_new_regulations(reset_test_data, regulatory_areas_to_update):
8384
pd.testing.assert_frame_equal(updated_regulations, regulatory_areas_to_update)
8485

8586

86-
def test_flow_regulations(create_cacem_tables, reset_test_data):
87-
state = flow.run()
88-
assert state.is_successful()
87+
def test_flow_regulatory_areas(create_cacem_tables, reset_test_data):
88+
state = regulatory_areas_flow(return_state=True)
89+
assert state.is_completed()

0 commit comments

Comments
 (0)