Sample code demonstrating usage of DASK from FastAPI. Application queries parquet dataset using Dask APIs.
Steps to run:
- Set up a virtual environment for Python 3 and enable it
- Run command
pip install -r requirements.txtto install the dependencies - Run command
dask-schedulerto start Dask Schedular, you can visit the dashboard here: http://localhost:8787/status - Run command
dask-worker localhost:8786to start Dask worker - Run command
uvicorn server:app --reload --port 8090to start the ASGI web server - Launch Swagger at http://localhost:8090/docs/
- Invoke HTTP via curl using command
curl -XGET http://localhost:8090/data/India - You should see the results as below:
{
"result": [
{
"id": 596,
"first_name": "Robin",
"last_name": "Carter",
"country": "India"
},
{
"id": 182,
"first_name": "Donna",
"last_name": "Boyd",
"country": "India"
}
]
}