Skip to content

The internet told me to trigger Databricks jobs and consume their results for a CRUD rest api on Databricks Delta Tables... no way, here is how to do it with the Alchemy ERM :)

License

Notifications You must be signed in to change notification settings

xristospk/databricks-table-crud-fastapi

Repository files navigation

databricks-table-crud-fastapi

Databricks preperation

Run FastAPI application

Configuration

  • Create a '.env' configuration file in the root directory (where the README.md is located)
  • Paste the content of the '.env.example' file in the root directory into '.env'
. \databricks-table-crud-flask-api
├── \sql_app
├── .env            < new File
├── .env.example
├── main.py
└── ...
  • Adjust the parameters (Access Token, HttpPath) and save the '.env' file

.env

DB_ACCESS_TOKEN=your-databricks-personal-access-token-here
DB_DATABASE=crudapidb
DB_HTTP_PATH=your-databricks-httpath-here

If you already have another/newer Python version <> v3.7 installed:

C:\source\databricks-table-crud-fastapi> pip install virtualenv
C:\source\databricks-table-crud-fastapi> virtualenv venv -p C:\Users\EMEAID\AppData\Local\Programs\Python\Python37\python.exe
C:\source\databricks-table-crud-fastapi> .\venv\Scripts\activate.ps1
(venv) C:\source\databricks-table-crud-fastapi> pip install https://download.lfd.uci.edu/pythonlibs/q4trcu4l/sasl-0.2.1-cp37-cp37m-win_amd64.whl
(venv) C:\source\databricks-table-crud-fastapi> pip install -r requirements.txt
(venv) C:\source\databricks-table-crud-fastapi> uvicorn main:app --reload

If you only have Python Version 3.7 installed:

  • Execute the following commands:

C:\source\databricks-table-crud-fastapi> python -m venv venv
C:\source\databricks-table-crud-fastapi> .\venv\Scripts\activate.ps1
(venv) C:\source\databricks-table-crud-fastapi> pip install https://download.lfd.uci.edu/pythonlibs/q4trcu4l/sasl-0.2.1-cp37-cp37m-win_amd64.whl
(venv) C:\source\databricks-table-crud-fastapi> pip install -r requirements.txt
(venv) C:\source\databricks-table-crud-fastapi> uvicorn main:app --reload

Navigate to http://127.0.0.1:8000/docs
Have fun creating, reading, updating and deleting records of the databricks delta table 'customers' :)

Miscellaneous

Debugging FastAPI:

Deployment to Azure App Service



About

The internet told me to trigger Databricks jobs and consume their results for a CRUD rest api on Databricks Delta Tables... no way, here is how to do it with the Alchemy ERM :)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published