Skip to content

Commit

Permalink
fix query and set to_sql to 'replace'
Browse files Browse the repository at this point in the history
  • Loading branch information
kena-SL committed Jan 21, 2025
1 parent 9300397 commit c52f25d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion digital_land/expectations/operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def count_deleted_entities(
# get dataset specific active resource list
params = urllib.parse.urlencode(
{
"sql": f"""select *,o.entity from reporting_historic_endpoints rhe join organisation o on rhe.organisation=o.organisation
"sql": f"""select * from reporting_historic_endpoints rhe join organisation o on rhe.organisation=o.organisation
where pipeline == '{db_name}' and o.entity='{organisation_entity}' and resource_end_date == "" group by endpoint""",
"_size": "max",
}
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/expectations/test_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@ def test_count_deleted_entities(dataset_path, mocker):

with spatialite.connect(dataset_path) as conn:
# load data into required tables
test_entity_data.to_sql("entity", conn, if_exists="append", index=False)
test_entity_data.to_sql("entity", conn, if_exists="replace", index=False)
test_fact_resource_data.to_sql(
"fact_resource", conn, if_exists="append", index=False
"fact_resource", conn, if_exists="replace", index=False
)
test_fact_data.to_sql("fact", conn, if_exists="append", index=False)
test_fact_data.to_sql("fact", conn, if_exists="replace", index=False)

# run expectation
passed, message, details = count_deleted_entities(
Expand Down

0 comments on commit c52f25d

Please sign in to comment.