Jacob Blanco

08/18/2020, 9:57 AM
I'm going crazy, I'm trying to pull a secret in a class task, and the type it returns is
<class 'prefect.configuration.Config'>
and I have no idea why. Did I do something wrong in the

Jim Crist-Harif

08/18/2020, 1:51 PM
Hi Jacobo, would you mind sharing an example configuration and the code you're using to pull in a secret that results in this behavior?
👀 1

Jacob Blanco

08/19/2020, 2:42 AM
Let me get back to you, thanks for responding.
The code is inside of a Task definition as shown below. The idea is to connect to GoogleSheets using the task (I realize there's one in the library already but our internal ones contain more specific functionality) :
from prefect import Task
from prefect.tasks.secrets import PrefectSecret
from prefect.utilities.tasks import defaults_from_attrs
from typing import Any, List

class ConnectToGoogleSheets(Task):
    def __init__(self, account_key: str = None, **kwargs: Any):
        self.account_key = account_key


    def run(self, **kwargs: Any):
        if not self.account_key:
            raise ValueError("The account key string must be provided")

        account_key_actual = PrefectSecret(self.account_key).run()

There's more code in the task definition but the type that gets returned is Config.