The current implementation of diepvries uses a different DML template for hub and link queries. Although, these queries are really similar so the multiple templates can be unified into a single template.
Solution
The following changes were performed:
Unify src/diepvries/template_sql/hub_dml.sql, src/diepvries/template_sql/link_dml.sql and src/diepvries/template_sql/role_playing_hub_dml.sql into a single template (src/diepvries/template_sql/hub_link_dml.sql);
Adapt hub.py, link.py and role_playing_hub.py to calculate the SQL placeholders for the new template SQL;
Adjust test suite for new templates;
Rename data_vault_table to target_table in all SQL templates. This change was not strictly needed, but makes sense to keep the placeholder for the schema and table aligned (target_schema/target_table instead of target_schema/data_vault_table).
(while there) Rename role_playing_hub_load_sql to test_role_playing_hub_load_sql. This test function was not prefixed with test, hence was not being picked up by pytest.
(while there) Merge data_vault_load tests with and without role playing hub. There was a lot of unnecessary redundancy between these two tests.
Context
The current implementation of
diepvries
uses a different DML template for hub and link queries. Although, these queries are really similar so the multiple templates can be unified into a single template.Solution
The following changes were performed:
src/diepvries/template_sql/hub_dml.sql
,src/diepvries/template_sql/link_dml.sql
andsrc/diepvries/template_sql/role_playing_hub_dml.sql
into a single template (src/diepvries/template_sql/hub_link_dml.sql
);hub.py
,link.py
androle_playing_hub.py
to calculate the SQL placeholders for the new template SQL;data_vault_table
totarget_table
in all SQL templates. This change was not strictly needed, but makes sense to keep the placeholder for the schema and table aligned (target_schema/target_table
instead oftarget_schema/data_vault_table
).role_playing_hub_load_sql
totest_role_playing_hub_load_sql
. This test function was not prefixed withtest
, hence was not being picked up bypytest
.Dependencies
Depends on https://github.com/PicnicSupermarket/diepvries/pull/14