Skip to main content

Download

Download remote files to the local system to make them available to UDFs across runs. Files are written to a disk shared across all UDFs in an organization.

fused.download

Call fused.download with the file's endpoint in the url parameter and the local file name in the file_path parameter. The function will download the file and return the file path, which other functions can reference.

This example downloads a .zip file then returns it as a GeoDataFrame.

@fused.udf
def udf(url='https://www2.census.gov/geo/tiger/TIGER_RD18/STATE/11_DISTRICT_OF_COLUMBIA/11/tl_rd22_11_bg.zip'):
import fused
import geopandas as gpd

# Download zip file
out_path = fused.download(url=url, file_path='out.zip')

# Show path to file
print(out_path)

return gpd.read_file(out_path)
info

The download function sets a lock to ensure the download happens only once, in case the UDF is called concurrently.