Hi everyone,
I’m currently working on integrating Looker with a FastAPI application using the Looker SDK version 4. I’ve created a function to execute a Looker query with a query_id, and I retrieve the results in JSON format. However, whenever I run the function, I consistently receive a “Model Not Found” error.
Here’s the function I’m using:
def get_data_from_looker(query_id=int):
try:
result = sdk.run_query(
query_id=query_id,
result_format=“json”,
limit=5000
)
count = len(result)
return {“query_id”: query_id, “result_count”: count, “query_result”: result}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
Error Message: Model Not Found
What I’ve Already Checked:
- The query_id is correct and exists in Looker.
- Authentication with the Looker SDK (initialized with looker_sdk.init40(config_file=‘./looker.ini’)) works fine.
- The model used by this query is correctly defined in Looker, and permissions are in place.