Turn your data into an API
- In Workbench create a new UDF that returns data, for example:
@fused.udf
def udf(path: str = "s3://fused-sample/demo_data/housing/housing_2024.csv"):
import pandas as pd
housing = pd.read_csv(path)
housing['price_per_area'] = round(housing['price'] / housing['area'], 2)
return housing[['price', 'price_per_area']]
- UDF Editor
- Advanced UDF Editor
- Click "Share" to open your UDF in a new Tab as a HTML Page
- Optionally: Edit the URL to return the data in your preferred file format.
For example changing the format from parquet to json:
# Returning as JSON
https://fused.io/.../run/file?format=json
# Returning as CSV
https://fused.io/.../run/file?format=csv
- Save your UDF with
Cmd + S(MacOS) /Ctrl + S(Win / Linux) - Click the 3 dots and open "Settings"
- Click HTTPS URL to open the UDF in it's default file format
Optionally: Edit the URL to return the data in your preferred file format.
For example changing the format from parquet to json:
# Returning as JSON
https://fused.io/.../run/file?format=json
# Returning as CSV
https://fused.io/.../run/file?format=csv