Skip to content

Commit

Permalink
🔥 removed credentials from task and flow.
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego-H-S committed Sep 19, 2024
1 parent 19ef1c1 commit 86edf5b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 0 additions & 6 deletions src/viadot/orchestration/prefect/flows/salesforce_to_adls.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 2 additions & 7 deletions src/viadot/orchestration/prefect/tasks/salesforce.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 86edf5b

Please sign in to comment.