Stephen Herron
08/02/2022, 1:28 AMimport asyncio
from prefect_snowflake import SnowflakeCredentials
from prefect import flow
creds = SnowflakeCredentials.load("credentials")
from prefect_snowflake.database import snowflake_query
@flow(name="Snowflake Query")
async def select_something():
result = await snowflake_query(
"select 1 as test",
creds,
)
if __name__ == "__main__":
asyncio.run(select_something())
Seems to work locally but when I try to run ad-hoc via a deployment I get the error:
...
prefect_snowflake/database.py", line 69, in snowflake_query
with snowflake_credentials.get_connection(**connect_params) as connection:
AttributeError: 'coroutine' object has no attribute 'get_connection'
alex
08/02/2022, 1:33 AMawait
your .load()
call and move the call inside your flow. We have some code that makes .load()
sync compatible, but it isn't currently working in deployments.Stephen Herron
08/02/2022, 11:16 AM