SQLizer Logo

Easily convert files into SQL databases

SQLizer API Multipart Upload

To upload large files SQLizer allows clients of its API to upload the file in many parts. This page explains how.

If you are uploading a file in multiple parts each part, with exception of the last part, must be at least 5Mb (5,242,880 bytes) but must be no more than 10,000,000 bytes. The final part must be no more than 10,000,000 bytes.

A simple way to partition your file is to use the unix split command. The following unix command will take your file and convert it to 5Mb parts named: Part_01, Part_02,...

split --numeric-suffixes=1 -b 5M FileName.xlsx Part_

Once you have partitioned your file into parts each part can be separately sent as a POST request to https://sqlizer.io/api/files/{ID}/data/ encoded as a multipart form with parameter name 'file'. The multipart form also needs a second parameter 'PartNumber' to indicate the part's order within the file. The first part should be given the value 1.

curl https://sqlizer.io/api/files/7EVHQlVpq6YrRGLxNyjJdZ-b7DN3hcKpbqwK215IyPpE8ZeddSK4GVe_q0LNdCZnNCwOi1ewyTSEVMy6rkpi8g==/data/ \
    -H "Authorization: Bearer {API-KEY}" \
    -F PartNumber=1 \
    -F "file=@/path/to/files/Part_01"

You can check whether an individual part has been uploading with a GET request to https://sqlizer.io/api/files/{ID}/data/?PartNumber={PartNumber}. The API will respond with a HTTP 200 code if the part was successfully uploaded and a HTTP 404 code if the part has not yet been successfully uploaded.

curl https://sqlizer.io/api/files/7EVHQlVpq6YrRGLxNyjJdZ-b7DN3hcKpbqwK215IyPpE8ZeddSK4GVe_q0LNdCZnNCwOi1ewyTSEVMy6rkpi8g==/data/?PartNumber=1 \
    -H "Authorization: Bearer {API-KEY}"

Once all parts have been uploaded, you should set the Status property of the top level file entity to Uploaded (just like you would do with a single part upload). SQLizer will then assemble all the parts and begin the conversion process.

curl -X PUT https://sqlizer.io/api/files/7EVHQlVpq6YrRGLxNyjJdZ-b7DN3hcKpbqwK215IyPpE8ZeddSK4GVe_q0LNdCZnNCwOi1ewyTSEVMy6rkpi8g==/ \
    -H "Authorization: Bearer {API-KEY}" \
    -d Status=Uploaded