From 2d3ee8d89d6422595a2eda335f50cc251d33afe1 Mon Sep 17 00:00:00 2001 From: adrian-wojcik Date: Fri, 15 Mar 2024 13:12:33 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor=20saprfc=20task?= =?UTF-8?q?=20in=20order=20to=20meet=20new=20logic=20in=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- viadot/tasks/sap_rfc.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/viadot/tasks/sap_rfc.py b/viadot/tasks/sap_rfc.py index 469b0b1df..fb059a467 100644 --- a/viadot/tasks/sap_rfc.py +++ b/viadot/tasks/sap_rfc.py @@ -19,7 +19,7 @@ class SAPRFCToDF(Task): def __init__( self, - query: str, + query: str = None, sep: str = None, replacement: str = "-", func: str = None, @@ -87,7 +87,7 @@ def __init__( "replacement", "func", "rfc_total_col_width_character_limit", - "credentials", + "sap_credentials", ) def run( self, @@ -134,10 +134,15 @@ def run( """ if sap_credentials is None: - credentials_str = AzureKeyVaultSecret( - secret=sap_credentials_key, - ).run() - sap_credentials = json.loads(credentials_str).get(env) + try: + credentials_str = AzureKeyVaultSecret( + secret=sap_credentials_key, + ).run() + sap_credentials = json.loads(credentials_str).get(env) + except: + logger.warning( + f"Getting credentials from Azure Key Vault was not possible. Either there is no key: {sap_credentials_key} or env: {env} or there is not Key Vault in your environment." + ) if alternative_version is True: if rfc_unique_id: