Amir
09/23/2022, 12:33 AMRuntimeError: A 'sync_compatible' method was called from a context that was previously async but is now sync. The sync call must be changed to run in a worker thread to support sending the coroutine for 'load' to the main thread.
I've dug into this error, and here are my findings:
• This error only seems to occur when I'm attempting to deploy to Azure while importing functions from another directory (either sibling or child directories).
• I'm able to successfully deploy the code to Blob Storage when I comment out the directory imports (and in association the related functions/tasks).
• I'm able to successfully spin up an agent and have the flows run through the local file system. This is isolated only when trying to deploy to Azure.
• The error stems from sync_compatible.
• Not many examples of this occurring in the past, but there is one in this slack channel and this posting here. Both are from the last ~3 weeks.
Any ideas? Thanks!
EDIT: Found a solution. Seems like this issue stemmed from my inexperience with the tool. I had broken up the file structure into a separate folder for Flows, Tasks and Functions. Issue was that I had the .py files for the functions written in a way where not all of the code was contained within a function.
ie:
engine = create_engine(snowflake...)
def test():
return
Did NOT work, whereas
def test():
engine = create_engine(snowflake...)
return
Did work.
I'll leave this here in case anyone else runs into a similar issue 🙂