Laura Vaida
06/29/2021, 7:21 AMJenny
06/29/2021, 1:00 PMLaura Vaida
06/29/2021, 1:31 PM{
"host" : "___",
"port" : "___",
"username" : "___,
"password" : "___"
}
Thanks @Jenny, like that for example? :)Jenny
06/29/2021, 1:33 PMLaura Vaida
06/29/2021, 3:14 PMJenny
06/29/2021, 3:42 PMfrom prefect import task, Flow
from prefect.tasks.secrets import PrefectSecret
@task
def access_secret(secret_value):
# Access your secret and now you can use it however you would like
print(secret_value['username'])
with Flow("secret-retrieval") as flow:
secret = PrefectSecret("MY_SECRET")
access_secret(secret)
flow.run()
Laura Vaida
07/01/2021, 8:36 AM@task(log_stdout=True)
def create_engine(snowflake_salesforce):
config = configparser.ConfigParser()
engine=create_engine(URL(**config[snowflake_salesforce]))
with Flow('UWG-Mail') as flow:
snowflake_credentials=PrefectSecret("Snowflake_Salesforce")
connection=create_engine(snowflake_salesforce=snowflake_credentials)
Unexpected error: TypeError("unhashable type: 'dict'")
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/prefect/engine/runner.py", line 48, in inner
new_state = method(self, state, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/prefect/engine/task_runner.py", line 863, in get_task_run_state
value = prefect.utilities.executors.run_task_with_timeout(
File "/usr/local/lib/python3.8/site-packages/prefect/utilities/executors.py", line 298, in run_task_with_timeout
return task.run(*args, **kwargs) # type: ignore
File "<input>", line 36, in create_engine
File "/usr/local/lib/python3.8/configparser.py", line 959, in __getitem__
if key != self.default_section and not self.has_section(key):
File "/usr/local/lib/python3.8/configparser.py", line 668, in has_section
return section in self._sections
TypeError: unhashable type: 'dict'
Jenny
07/01/2021, 3:40 PMLaura Vaida
07/01/2021, 4:07 PM