Created
August 8, 2023 15:56
-
-
Save NicolasPA/87e7305fffdcc039e1312ff9554d1074 to your computer and use it in GitHub Desktop.
xml2db data flow test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import xml2db | |
data_model = xml2db.DataModel.create_from_xsd_file( | |
xsd_file=xsd_path, | |
db_schema=db_schema, | |
connection_string=connection_string, | |
model_config=model_config, | |
) | |
document = data_model.parse_xml( | |
xml_file="tests/remit_data_flow_tests/remit_table1_v2_anonymized_input.xml" | |
) | |
document.insert_into_target_tables() | |
result_df = pd.read_sql_query(con=sql_engine, sql="select * from the_whole_joined_schema") | |
with open( | |
r"tests/remit_data_flow_tests/remit_table1_v2_expected_output.pickle", "rb" | |
) as f: | |
expected_df = pickle.load(f) | |
pd.testing.assert_frame_equal(result, expected_df) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment