Skip to main content

Staging Files with API

You can use the File Upload API to stage a file by uploading a local file to a stage. This API can be called using curl or other HTTP client tools. Alternatively, you can also upload files directly to the folder in your bucket that maps to a stage using a web browser. Once uploaded, Databend can recognize them as staged files.

Examples

The following examples demonstrate how to upload a sample file (books.parquet) to the user stage, an internal stage, and an external stage with the File Upload API.

Use cURL to make a request to the File Upload API:

Put books.parquet to stage
curl -u root: -H "stage_name:~" -F "upload=@books.parquet" -XPUT "http://localhost:8000/v1/upload_to_stage"
Response
{"id":"bf2574bd-a467-4690-82b9-12549a1875d4","stage_name":"~","state":"SUCCESS","files":["books.parquet"]}

Check the staged file:

LIST @~;

name |size|md5|last_modified |creator|
-------------+----+---+-----------------------------+-------+
books.parquet| 998| |2023-04-20 20:55:03.100 +0000| |