Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.4.23 PR #828

Merged
merged 68 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
551203c
🚀 Bumped version after release
Rafalz13 Nov 15, 2023
53eae88
📝 Added docstring to `slugify()`
Rafalz13 Nov 17, 2023
b056a05
✅ Added tests for `slugify()` and `handle_api_response()`
Rafalz13 Nov 17, 2023
ef4a650
✅ Added missing test for `check_value()`
Rafalz13 Nov 17, 2023
78ea413
✅ Added SQL related missing tests
Rafalz13 Nov 22, 2023
91ea25c
✅ Added missing test for `gen_bulk_insert_query_from_df`
Rafalz13 Nov 22, 2023
bcdfa98
✅ Added missing test for `union_dict()`
Rafalz13 Nov 22, 2023
74beb6e
✨ Added new logic to map and reorder output df
burzecj Nov 24, 2023
2885731
Added CHANGELOG.md
burzecj Nov 24, 2023
e6c82e3
Updated api url in connector
KaterynaIurieva Nov 24, 2023
a638571
Updated api url in connector
KaterynaIurieva Nov 24, 2023
6bb29fe
Merge branch 'fix_vidclub_connector' of https://github.com/KaterynaIu…
KaterynaIurieva Nov 24, 2023
5092684
Update viadot/sources/vid_club.py
KaterynaIurieva Nov 27, 2023
45250ea
Update viadot/sources/vid_club.py
KaterynaIurieva Nov 27, 2023
19b9812
function to check if df empty
marcinpurtak Nov 28, 2023
c4f07df
function to check if df empty enhanced
marcinpurtak Nov 28, 2023
df729f5
♻️ merged path and adls_file_name into file_name
cgildenia Nov 29, 2023
759adf2
♻️ updated docstring
cgildenia Nov 29, 2023
495f3c5
✨ added to_csv in list class
cgildenia Nov 29, 2023
8a61518
✅ added more tests for genesys Task
burzecj Nov 29, 2023
34859ed
Modified logic for check df. Df check and flow Finish in the flow added
marcinpurtak Nov 29, 2023
b10a951
♻️ removed unused code
cgildenia Nov 29, 2023
6dc7a6f
✨ added separator argument for csv saving
cgildenia Nov 30, 2023
7c6b9e3
⚡️ Replaced `check_value` and `get_nested_dict` with one - `get_neste…
Rafalz13 Nov 30, 2023
102fc93
🐛 Added tests for `test_nested_value` function
Rafalz13 Nov 30, 2023
8956716
♻️ Changed funtion from `get_nested_dict` to `get_nested_value`
Rafalz13 Nov 30, 2023
dfacdfa
♻️ Changed funtion from `check_value` to `get_nested_value` in genesys
Rafalz13 Nov 30, 2023
416ca6e
Changed dosc string for new class arguments
burzecj Dec 1, 2023
895b1d0
Merge pull request #820 from burzekj/web_msg_logic_fix
Rafalz13 Dec 1, 2023
b6cfd41
update for sharepoint list to df with function for checking df
marcinpurtak Dec 1, 2023
9c26050
changed with case in sharepoint to adls
marcinpurtak Dec 2, 2023
371223b
✅ added tests for sharepoint list
cgildenia Dec 4, 2023
c0ae042
🐛 Added warning logger for credential
Dec 4, 2023
a999d91
Add changes to changelog
Dec 4, 2023
d69733b
🎨 Delete "WARNING!!!" from warning message
Dec 4, 2023
5e4fa56
added conn.close after each session to sappw
gwieloch Dec 4, 2023
b08dbff
✨ list extension is now a literal
cgildenia Dec 4, 2023
8540e19
✅ added wrong extension test
cgildenia Dec 4, 2023
91e9d0b
🎨 Change structure of 'if' instruction and added to SAPRFCV2
Dec 5, 2023
6334ad4
✅ Added tests for new functionalities for SAPRFC and SAPRFCV2
Dec 5, 2023
4f3efc9
cleaned check_connection and get_response methods
KaterynaIurieva Dec 5, 2023
35f9840
Merge branch 'fix_vidclub_connector' of https://github.com/KaterynaIu…
KaterynaIurieva Dec 5, 2023
635c146
changed raise to endrun
marcinpurtak Dec 5, 2023
1e57011
Merge pull request #823 from cgildenia/sharepoint_list_to_csv
Rafalz13 Dec 5, 2023
48ddcd6
unify region parameter
KaterynaIurieva Dec 5, 2023
8bea0c6
Merge pull request #825 from gwieloch/sapbw
Rafalz13 Dec 5, 2023
be1a72e
Moved tasks to task_utils + tests added
marcinpurtak Dec 5, 2023
bcefcc7
Merge branch 'dev' into sap_rfc_credential_error_bug
Rafalz13 Dec 6, 2023
f282f55
Merge branch 'dev' of https://github.com/dyvenia/viadot into feature/…
marcinpurtak Dec 6, 2023
6dc722f
Merge pull request #824 from adrian-wojcik/sap_rfc_credential_error_bug
Rafalz13 Dec 6, 2023
2f7ed2a
🎨 Format Python code with Black
github-actions[bot] Dec 6, 2023
7aac8b0
Fixed total_load method, updated tests
KaterynaIurieva Dec 6, 2023
f7de232
Merge pull request #822 from KaterynaIurieva/fix_vidclub_connector
Rafalz13 Dec 6, 2023
8f447aa
🔊 Updated logger warning
angelika233 Dec 6, 2023
8f6075b
Updated tests, removed not necessary imports, changed file path param…
marcinpurtak Dec 6, 2023
06c3f41
Merge branch 'dev' into feature/sharepoint_multiflows_control
Rafalz13 Dec 6, 2023
8d326ea
Apply suggestions from code review
marcinpurtak Dec 6, 2023
b63d16e
Dot added
marcinpurtak Dec 6, 2023
9fd6e6f
Formatting fix
marcinpurtak Dec 6, 2023
d4589a5
Merge pull request #826 from dyvenia/feature/sharepoint_multiflows_co…
Rafalz13 Dec 6, 2023
ac1ebcb
Merge branch 'dev' into improve_utils_coverage
Rafalz13 Dec 6, 2023
f269f3e
Merge pull request #817 from dyvenia/improve_utils_coverage
Rafalz13 Dec 6, 2023
bd0d155
🐛 Changed `cols_to_drop` in VidClub
Rafalz13 Dec 7, 2023
41204af
🐛 Changed test for VidClub flow
Rafalz13 Dec 7, 2023
434fc66
🔥 Removed unused parameters
Rafalz13 Dec 7, 2023
d8b693d
Merge pull request #827 from dyvenia/fix_tests_for_release4_23
Rafalz13 Dec 7, 2023
a9b6f66
🔥 Removed test for `get_sql_server_table_dtypes`
Rafalz13 Dec 7, 2023
a104422
📝 Updated Changelog before release
Rafalz13 Dec 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

## [0.4.23] - 2023-12-07
### Added
- Added tests for new functionalities in SAPRFC and SAPRFCV2 regarding passing credentials.
- Added new params for mapping and reordering DataFrame for `Genesys` task and flow.
- Added `get_task_logs` task to search for logs in the flow
- Added `get_flow_run_id` task to find flow ID.
- Added `search_for_msg_in_logs` task used to control flows in multiflows by searching for a given log message from a given task.
- Added closing session to `SAPBW`.
- Added `CSV` as a new output extension to `SharepointListToADLS` flow.

### Fixed
- Fixed creation of URL in `VidClub` source class. When the `region=None` the region parameter will not be included in the URL.

### Changed
- `if_no_data_returned` added for sharepoint list flow which can fail, warn in case of no data returend or skip (continue) execution in the old way.
- Changed `__init__` in `SAPRFC` and `SAPRFCV2` class in source in order to raise warning in prefect when credentials will be taken from DEV.


## [0.4.22] - 2023-11-15
### Added
Expand Down
12 changes: 3 additions & 9 deletions tests/integration/flows/test_bigquery_to_adls.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,9 @@ def test_bigquery_to_adls_validate_df_fail(mocked_data):
adls_sp_credentials_secret=ADLS_CREDENTIAL_SECRET,
validate_df_dict={"column_list_to_match": ["type", "country", "test"]},
)
try:
result = flow_bigquery.run()
except ValidationError:
pass

os.remove("test_bigquery_to_adls_validate_df_fail.parquet")
os.remove("test_bigquery_to_adls_validate_df_fail.json")
result = flow_bigquery.run()
assert result.is_failed()


@mock.patch(
Expand Down Expand Up @@ -138,7 +134,5 @@ def test_bigquery_to_adls_validate_df_success(mocked_data):
os.remove("test_bigquery_to_adls_validate_df_success.parquet")
os.remove("test_bigquery_to_adls_validate_df_success.json")

rm = AzureDataLakeRemove(
path=ADLS_DIR_PATH + ADLS_FILE_NAME, vault_name="azuwevelcrkeyv001s"
)
rm = AzureDataLakeRemove(path=ADLS_DIR_PATH + ADLS_FILE_NAME)
rm.run(sp_credentials_secret=ADLS_CREDENTIAL_SECRET)
2 changes: 0 additions & 2 deletions tests/integration/flows/test_mysql_to_adls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def test_adls_gen1_to_azure_sql_new_mock(TEST_PARQUET_FILE_PATH):
query=query,
file_path=TEST_PARQUET_FILE_PATH,
to_path=f"raw/examples/{TEST_PARQUET_FILE_PATH}",
sp_credentials_secret="App-Azure-CR-DatalakeGen2-AIA-DEV",
overwrite_adls=True,
)
flow.run()
Expand All @@ -32,7 +31,6 @@ def test_validate_df(TEST_PARQUET_FILE_PATH):
country_short="DE",
query=query,
file_path=TEST_PARQUET_FILE_PATH,
sp_credentials_secret="App-Azure-CR-DatalakeGen2-AIA",
to_path=f"raw/examples/{TEST_PARQUET_FILE_PATH}",
validate_df_dict={"column_size": {"sales_org": 3}},
)
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/flows/test_salesforce_to_adls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def test_salesforce_to_adls():
os.remove("test_salesforce_to_adls_run_flow.json")
rm = AzureDataLakeRemove(
path=ADLS_DIR_PATH + ADLS_FILE_NAME,
vault_name="azuwevelcrkeyv001s",
)
rm.run(sp_credentials_secret=credentials_secret)

Expand All @@ -56,6 +55,5 @@ def test_salesforce_to_adls_validate_success():
os.remove("test_salesforce_to_adls_run_flow.json")
rm = AzureDataLakeRemove(
path=ADLS_DIR_PATH + ADLS_FILE_NAME,
vault_name="azuwevelcrkeyv001s",
)
rm.run(sp_credentials_secret=credentials_secret)
175 changes: 173 additions & 2 deletions tests/integration/flows/test_sharepoint_to_adls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@
import pendulum
import pytest
from prefect.tasks.secrets import PrefectSecret
from viadot.flows import SharepointToADLS, SharepointListToADLS

from viadot.flows import SharepointToADLS
from viadot.tasks import AzureDataLakeRemove

ADLS_FILE_NAME = str(pendulum.now("utc")) + ".csv"
ADLS_FILE_NAME_LIST = pendulum.now("utc").strftime("%Y-%m-%d_%H:%M:%S_%Z%z")
ADLS_DIR_PATH = "raw/tests/"
CREDENTIALS_SECRET = PrefectSecret("AZURE_DEFAULT_ADLS_SERVICE_PRINCIPAL_SECRET").run()
DATA = {"country": [1, 2], "sales": [3, 4]}
EMPTY_DATA = {}


# SharepointToADLS


@mock.patch(
Expand Down Expand Up @@ -69,7 +74,173 @@ def test_sharepoint_to_adls_run_flow_overwrite_false(mocked_class):
overwrite_adls=False,
)
result = flow.run()

assert result.is_failed()
os.remove("test_sharepoint_to_adls_run_flow_overwrite_false.csv")
os.remove("test_sharepoint_to_adls_run_flow_overwrite_false.json")


# SharepointListToADLS


@mock.patch(
"viadot.tasks.SharepointListToDF.run",
return_value=pd.DataFrame(data=DATA),
)
@pytest.mark.run
def test_sharepoint_list_to_adls_run_flow_csv(mocked_class):
flow = SharepointListToADLS(
"test_sharepoint_to_adls_run_flow",
output_file_extension=".csv",
adls_sp_credentials_secret=CREDENTIALS_SECRET,
adls_dir_path=ADLS_DIR_PATH,
file_name=ADLS_FILE_NAME_LIST,
list_title="",
site_url="",
)
result = flow.run()
assert result.is_successful()
os.remove(ADLS_FILE_NAME_LIST + ".csv")
os.remove("test_sharepoint_to_adls_run_flow.json")


@mock.patch(
"viadot.tasks.SharepointListToDF.run",
return_value=pd.DataFrame(data=DATA),
)
@pytest.mark.run
def test_sharepoint_list_to_adls_run_flow_parquet(mocked_class):
flow = SharepointListToADLS(
"test_sharepoint_to_adls_run_flow",
output_file_extension=".parquet",
adls_sp_credentials_secret=CREDENTIALS_SECRET,
adls_dir_path=ADLS_DIR_PATH,
file_name=ADLS_FILE_NAME_LIST,
list_title="",
site_url="",
)
result = flow.run()
assert result.is_successful()
os.remove(ADLS_FILE_NAME_LIST + ".parquet")
os.remove("test_sharepoint_to_adls_run_flow.json")


@mock.patch(
"viadot.tasks.SharepointListToDF.run",
return_value=pd.DataFrame(data=DATA),
)
@pytest.mark.run
def test_sharepoint_list_to_adls_run_flow_wrong_extension(mocked_class):
with pytest.raises(ValueError) as exc:
flow = SharepointListToADLS(
"test_sharepoint_to_adls_run_flow",
output_file_extension=".s",
adls_sp_credentials_secret=CREDENTIALS_SECRET,
adls_dir_path=ADLS_DIR_PATH,
file_name=ADLS_FILE_NAME_LIST,
list_title="",
site_url="",
)
result = flow.run()
assert "Output file extension can only be '.csv' or '.parquet'" in str(exc.value)


@mock.patch(
"viadot.tasks.SharepointListToDF.run",
return_value=pd.DataFrame(data=DATA),
)
@pytest.mark.run
def test_sharepoint_list_to_adls_run_flow_overwrite_true(mocked_class):
flow = SharepointListToADLS(
"test_sharepoint_to_adls_run_flow_overwrite_true",
output_file_extension=".csv",
adls_sp_credentials_secret=CREDENTIALS_SECRET,
adls_dir_path=ADLS_DIR_PATH,
file_name=ADLS_FILE_NAME_LIST,
overwrite_adls=True,
list_title="",
site_url="",
)
result = flow.run()
assert result.is_successful()
os.remove(ADLS_FILE_NAME_LIST + ".csv")
os.remove("test_sharepoint_to_adls_run_flow_overwrite_true.json")


@mock.patch(
"viadot.tasks.SharepointListToDF.run",
return_value=pd.DataFrame(data=EMPTY_DATA),
)
@pytest.mark.run
def test_sharepoint_list_to_adls_run_flow_fail_on_no_data_returned(mocked_class):
"""
Test will check if flow is failing when empty DF is passed
with the given parameter if_no_data_returned = "fail"
CSV file should not be generated!
"""
flow = SharepointListToADLS(
"test_sharepoint_to_adls_run_flow",
output_file_extension=".csv",
adls_sp_credentials_secret=CREDENTIALS_SECRET,
adls_dir_path=ADLS_DIR_PATH,
file_name=ADLS_FILE_NAME_LIST,
list_title="",
site_url="",
if_no_data_returned="fail",
)
result = flow.run()
assert result.is_failed()


@mock.patch(
"viadot.tasks.SharepointListToDF.run",
return_value=pd.DataFrame(data=EMPTY_DATA),
)
@pytest.mark.run
def test_sharepoint_list_to_adls_run_flow_success_on_no_data_returned(mocked_class):
"""
Test will check if flow will succeed when empty DF is passed
with the given parameter if_no_data_returned = "skip"
Empty csv should be generated!
"""
flow = SharepointListToADLS(
"test_sharepoint_to_adls_run_flow",
output_file_extension=".csv",
adls_sp_credentials_secret=CREDENTIALS_SECRET,
adls_dir_path=ADLS_DIR_PATH,
file_name=ADLS_FILE_NAME_LIST,
list_title="",
site_url="",
if_no_data_returned="skip",
)
result = flow.run()
assert result.is_successful()
os.remove(ADLS_FILE_NAME_LIST + ".csv")
os.remove("test_sharepoint_to_adls_run_flow.json")


@mock.patch(
"viadot.tasks.SharepointListToDF.run",
return_value=pd.DataFrame(data=EMPTY_DATA),
)
@pytest.mark.run
def test_sharepoint_list_to_adls_run_flow_success_warn_on_no_data_returned(
mocked_class,
):
"""
Test will check if flow is failing when empty DF is passed
with the given parameter if_no_data_returned = "warn"
CSV file should not be generated!
"""
# Get prefect client instance
flow = SharepointListToADLS(
"test_sharepoint_to_adls_run_flow",
output_file_extension=".csv",
adls_sp_credentials_secret=CREDENTIALS_SECRET,
adls_dir_path=ADLS_DIR_PATH,
file_name=ADLS_FILE_NAME_LIST,
list_title="",
site_url="",
if_no_data_returned="warn",
)
result = flow.run()
assert result.is_successful()
10 changes: 3 additions & 7 deletions tests/integration/flows/test_vidclub_to_adls.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def test_vidclub_validate_df_task_success(caplog):
to_date="2023-10-25",
adls_dir_path="raw/tests",
adls_file_name="test.parquet",
adls_sp_credentials_secret="App-Azure-CR-DatalakeGen2-AIA",
overwrite_adls=True,
validate_df_dict={
"column_size": {"submissionID": 5},
Expand Down Expand Up @@ -78,15 +77,12 @@ def test_vidclub_validate_df_task_fail(caplog):
to_date="2023-10-25",
adls_dir_path="raw/tests",
adls_file_name="test.parquet",
adls_sp_credentials_secret="App-Azure-CR-DatalakeGen2-AIA",
overwrite_adls=True,
validate_df_dict={
"column_size": {"submissionID": 5},
"column_unique_values": ["regionID"],
"column_unique_values": ["id"],
},
)

try:
flow.run()
except ValidationError:
pass
result = flow.run()
assert result.is_failed()
39 changes: 38 additions & 1 deletion tests/integration/tasks/test_genesys_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ def genesys_api_connection(post_data_list, end_point, method="POST"):
"messages": [],
}
],
"pageCount": 2,
"entities": [{"id": "xxx"}],
}

else:
report = {
"conversations": [
Expand Down Expand Up @@ -307,7 +310,7 @@ def test_genesys_conversations(mock_genesys, var_dictionary):

@mock.patch("viadot.tasks.genesys.Genesys", return_value=MockGenesysTask)
@pytest.mark.conv
def test_genesys_webmsg(mock_genesys, var_dictionary):
def test_genesys_webmsg_conversations(mock_genesys, var_dictionary):
to_csv = GenesysToCSV()
file_name = to_csv.run(
view_type=None,
Expand All @@ -324,3 +327,37 @@ def test_genesys_webmsg(mock_genesys, var_dictionary):

mock_genesys.assert_called_once()
assert file_name[0] == f"WEBMESSAGE_{start}-{end}.csv"


@mock.patch("viadot.tasks.genesys.Genesys", return_value=MockGenesysTask)
@pytest.mark.conv
def test_genesys_users(mock_genesys, var_dictionary):
to_csv = GenesysToCSV()
file_name = to_csv.run(
view_type=None,
end_point="users",
conversationId_list=var_dictionary["v_list"],
post_data_list=[""],
key_list=var_dictionary["key_list"],
start_date=var_dictionary["start_date"],
end_date=var_dictionary["end_date"],
)

mock_genesys.assert_called_once()
assert file_name[0] == f"All_Genesys_Users.csv"


@mock.patch("viadot.tasks.genesys.Genesys", return_value=MockGenesysTask)
@pytest.mark.conv
def test_genesys_queue_performance_detail_view(mock_genesys, var_dictionary):
genesys = GenesysToCSV()
output = genesys.run(
view_type="queue_performance_detail_view",
end_point=None,
conversationId_list=var_dictionary["v_list"],
post_data_list=[""],
key_list=var_dictionary["key_list"],
start_date=var_dictionary["start_date"],
end_date=var_dictionary["end_date"],
)
assert output is None
Loading
Loading