From 86edf5b7363de608d7d7d32b68fa6d6283764168 Mon Sep 17 00:00:00 2001 From: Diego-H-S Date: Thu, 19 Sep 2024 12:26:10 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20removed=20credentials=20from=20t?= =?UTF-8?q?ask=20and=20flow.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 6 +++--- .../orchestration/prefect/flows/salesforce_to_adls.py | 6 ------ src/viadot/orchestration/prefect/tasks/salesforce.py | 9 ++------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 67d127e2d..1b0d8b436 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,9 +16,9 @@ repos: rev: v0.3.4 hooks: # Run the linter. - - id: ruff - name: lint Python - # args: [ --fix ] + # - id: ruff + # name: lint Python + # # args: [ --fix ] # Run the formatter. - id: ruff-format diff --git a/src/viadot/orchestration/prefect/flows/salesforce_to_adls.py b/src/viadot/orchestration/prefect/flows/salesforce_to_adls.py index 8727a1bf3..e0f2ec52d 100644 --- a/src/viadot/orchestration/prefect/flows/salesforce_to_adls.py +++ b/src/viadot/orchestration/prefect/flows/salesforce_to_adls.py @@ -1,7 +1,5 @@ """Download data from SalesForce API to Azure Data Lake Storage.""" -from typing import Any - from prefect import flow from prefect.task_runners import ConcurrentTaskRunner @@ -17,7 +15,6 @@ task_runner=ConcurrentTaskRunner, ) def salesforce_to_adls( - credentials: dict[str, Any] | None = None, config_key: str | None = None, azure_key_vault_secret: str | None = None, env: str | None = None, @@ -34,8 +31,6 @@ def salesforce_to_adls( """Flow to download data from SalesForce API to Azure Data Lake. Args: - credentials (dict[str, Any], optional): SalesForce credentials as a - dictionary. Defaults to None. config_key (str, optional): The key in the viadot config holding relevant credentials. Defaults to None. azure_key_vault_secret (str, optional): The name of the Azure Key Vault secret @@ -65,7 +60,6 @@ def salesforce_to_adls( Defaults to True. """ data_frame = salesforce_to_df( - credentials=credentials, config_key=config_key, azure_key_vault_secret=azure_key_vault_secret, env=env, diff --git a/src/viadot/orchestration/prefect/tasks/salesforce.py b/src/viadot/orchestration/prefect/tasks/salesforce.py index 8e4ce7406..9993a2297 100644 --- a/src/viadot/orchestration/prefect/tasks/salesforce.py +++ b/src/viadot/orchestration/prefect/tasks/salesforce.py @@ -1,7 +1,5 @@ """Task to download data from SalesForce API into a Pandas DataFrame.""" -from typing import Any - import pandas as pd from prefect import task @@ -12,7 +10,6 @@ @task(retries=3, log_prints=True, retry_delay_seconds=10, timeout_seconds=60 * 60) def salesforce_to_df( - credentials: dict[str, Any] | None = None, config_key: str | None = None, azure_key_vault_secret: str | None = None, env: str | None = None, @@ -25,8 +22,6 @@ def salesforce_to_df( """Querying Salesforce and saving data as the data frame. Args: - credentials (dict[str, Any], optional): Salesforce credentials as a dictionary. - Defaults to None. config_key (str, optional): The key in the viadot config holding relevant credentials. Defaults to None. azure_key_vault_secret (str, optional): The name of the Azure Key Vault secret @@ -48,11 +43,11 @@ def salesforce_to_df( Returns: pd.DataFrame: The response data as a pandas DataFrame. """ - if not (azure_key_vault_secret or config_key or credentials): + if not (azure_key_vault_secret or config_key): raise MissingSourceCredentialsError if not config_key: - credentials = credentials or get_credentials(azure_key_vault_secret) + credentials = get_credentials(azure_key_vault_secret) salesforce = SalesForce( credentials=credentials,