CREATE FILE
Note:
Only use an approved HTTPS download URL reachable by the service. Replace
<artifact-host>with your approved artifact host. Files, especially private keys, must be handled as secrets. Do not use a publicly readable URL for secret material. Confirm an appropriate provisioning mechanism with VeloDB Cloud support.
Description
This statement is used to create and upload a file to the engine deployment. This function is usually used to manage files that need to be used in some other commands, such as certificates, public and private keys, and so on.
Syntax
CREATE FILE <file_name>
[ { FROM | IN } <database_name>] PROPERTIES ("<key>"="<value>" [ , ... ]);
Required parameters
1. <file_name>
Custom file name.
2. <key>
File attribute key.
- url: Required. Specifies an unauthenticated HTTP download URL. After successful execution, the file will be stored in the warehouse and this URL will no longer be required.
- catalog: Required. Category name for file classification (user-defined). Used to locate files in specific commands ( e.g., searches for files under 'kafka' catalog when Kafka is the data source in scheduled imports).
- md5: Optional. MD5 checksum of the file. If provided, verification will be performed after download.
3. <value>
File attribute value.
Optional parameters
1. <database_name>
Specifies the database to which the file belongs. Uses current session's database if not specified.
Access control requirements
The user executing this SQL command must possess at least the following privileges:
| Privilege | Object | Notes |
|---|---|---|
ADMIN_PRIV | User / Role | The user or role must hold the ADMIN_PRIV privilege to execute this operation |
Usage notes
- File Access Rules
Each file belongs to a specific database (Database). Users with access privileges to the database can access all files within it.
- File Size and Quantity Limits
This feature is primarily designed for managing small files such as certificates.
Size limit: The compiledmax_small_file_size_bytesdefault is 1 MiB. The effective warehouse setting is service-managed. Quantity limit: The compiledmax_small_file_numberdefault is 100 files across the engine file manager, not 100 per database. Confirm the effective warehouse setting with support.
Example
-
Create a file ca.pem , classified as kafka
CREATE FILE "ca.pem"PROPERTIES("url" = "https://<artifact-host>/ca.pem","catalog" = "kafka"); -
Create a file client.key, classified as my_catalog
CREATE FILE "client.key"IN my_databasePROPERTIES("url" = "https://<artifact-host>/client.key","catalog" = "my_catalog","md5" = "b5bb901bf10f99205b39a46ac3557dd9"); -
Create a file client_1.key, classified as my_catalog
CREATE FILE "client_1.key"FROM my_databasePROPERTIES("url" = "https://<artifact-host>/client.key","catalog" = "my_catalog","md5" = "b5bb901bf10f99205b39a46ac3557dd9");