I am new to Pyton fastAPI and Kubernetes and developing a REST-API with Python's fastAPI which will run in a Kubernetes environment. The API will receive files or images from the client by following code:
@app.post("/FileUpload/")
async def upload_file(file: UploadFile = File(...)):
...
return {"filename": file.filename}
This file should be uploaded after receiving to snowflake without any processing by following code
sql = f'''PUT 'file://{file}' '@{snowflake_connector.PAYLOAD_STAGE}/{snowflake_connector.PAYLOAD_STAGE_PATH}' AUTO_COMPRESS=FALSE;'''
and pandas method read_sql(query, connection)
to snowflake.
Unfortunately I did not found a solution to upload the received file on the fly, so the file must be chached. What would be the best way to achive this? Or am I missig something?
I am using Python 3.7.7.
Any help is appreciated.