SQLizer Logo

Easily convert files into SQL databases

PUT /api/files/{ID}

This endpoint can be used to update the properties of a file conversion entity. It accepts the following parameters:

Name Type Required Remarks
Status String The only value ever provided when calling this endpoint should be "Uploaded". This is used to tell SQLizer that the upload process has finished and it can begin analysing the input file.
FileType String Must be either "csv", "json", "xlsx" or "xml"
FileName String The name of the file. For most file conversions types this is just used for display purposes. For example, the SQLizer "/files/" page shows a list of previously uploaded files. However, for Excel conversions, the extension of the upload file is significant. Files with an ".xls" extension will be treated as legacy Excel 97 - Excel 2003 Binary file format (BIFF8) files.
TableName String The name of the database table to use. SQLizer may alter this value in order to ensure a valid SQL file is produced. Whitespace from either side of the table name will be trimmed, and any non-alphanumeric characters will be converted to underscores.
DatabaseType String Must be either "MySQL", "SQLServer", "PostgreSQL" or "SQLite"
FileHasHeaders Boolean

Tells SQLizer whether to use the first row of the file for the column names, and exclude it from the analysis of what column types to use. Or to include the first row in the outputted data.

Must be provided for the following FileTypes: csv, xlsx.

Delimiter String

If the FileType is csv, tells SQLizer what characters to use to separate column values.

A value of "\t" can be used to signify a tab character, i.e. a string containing a backslash character followed by the letter t, because many platforms/libraries will not encode a raw tab charater into the JSON payload.

If specified, the value must be 1 character long (except when the value is "\t").

Defaults to a comma "," if not specified.

SheetName String

If the FileType is xlsx, tells SQLizer which worksheet to load data from.

Defaults to the currently active worksheet if not specified.

CellRange String

If the FileType is xlsx, tells SQLizer which range of cells to load data from.

Defaults to the whole worksheet if not specified.

CheckTableExists Boolean

Tells SQLizer to generate SQL code to check the table doesn't exist before attempt to create it. Having scripts that can still run even if the table already exists is useful when using our API to regularly import data into a single table.

Defaults to true.

InsertSpacing Integer

The number of lines of data values to concatenate together in a single insert statement.

Defaults to 250.

SQLizer will respond with a 200 HTTP code a JSON respresentation of the updated file entity:

{
    "ID": "7EVHQlVpq6YrRGLxNyjJdZ-b7DN3hcKpbqwK215IyPpE8ZeddSK4GVe_q0LNdCZnNCwOi1ewyTSEVMy6rkpi8g==",
    "DatabaseType": "MySQL",
    "Status": "Queued",
    "FileType": "xlsx",
    "FileName": "file.xlsx",
    "TableName": "table_name",
    "FileHasHeaders": true,
    "SheetName": "Sheet1",
    "CellRange": "A1:F100",
    "CheckTableExists": true,
    "InsertSpacing": 250
}

When updaing the file entity, the status property will typically update to the "Queued" value. For example, if conversion is at the "Processing" status, and the SheetName property is updated the Status will revert to "Queued" as the conversion process will need to restart.