Skip to content

Commit

Permalink
♻️ Refactor saprfc task in order to meet new logic in source
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-wojcik committed Mar 15, 2024
1 parent 92c2b70 commit 2d3ee8d
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions viadot/tasks/sap_rfc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class SAPRFCToDF(Task):
def __init__(
self,
query: str,
query: str = None,
sep: str = None,
replacement: str = "-",
func: str = None,
Expand Down Expand Up @@ -87,7 +87,7 @@ def __init__(
"replacement",
"func",
"rfc_total_col_width_character_limit",
"credentials",
"sap_credentials",
)
def run(
self,
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2d3ee8d

Please sign in to comment.