Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Json API endpoint for Delta Lake
from deltalake import DeltaTable
from flask import request, jsonify
app = flask.Flask(__name__)
app.config["DEBUG"] = True
@app.route('/read-delta-table', methods=['GET'])
def home():
dt = DeltaTable("/tmp/delta/students-delta-table/")
pd = dt.to_pyarrow_dataset().to_table().to_pandas()
json_str = pd.to_json(orient = "records")
parsed = json.loads(json_str)
return jsonify(parsed)
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment