24.1. Creating a Storage (metastore.add_storage) #
Before creating an S3 storage, you must create a simple secret. You can create only one S3 storage.
Required privileges: Postgres Pro AXE administrator only. For more information about stored procedures and privileges, refer to Section 22.1.
Execute the following command:
SELECT metastore.add_storage('storage_name', 'root_directory_URI', 'temporary_directory_URI');
Where:
storage_name: The unique storage name.root_directory_URI: The URI of the root directory of the storage.temporary_directory_URI: The URI of the storage directory for temporary files.
Local storages have simple URIs, for example, file:///home/j.doe/workspace/axe/.
S3 storages have URIs with more complicated structures and parsing, for example, s3://premdb/team01.csv?versionId=w_B5qT8s5MkiT09.IRHay0lW.PycsHTS. These URIs are generated using third-party libraries.
Postgres Pro AXE performs the following actions:
Verifies input parameters and user privileges.
Ensures that there is enough free space for the storage. By default, 10 GB is required.
Ensures that the specified directories exist.
Creates a new entry in the
pga_storagemetadata table.
Example 24.1. Executing the metastore.add_storage stored procedure (local storage)
SELECT metastore.add_storage('local_storage_example', 'file:///tmp/local_storage_example/', 'file:///tmp/local_storage_example/tmp_dir/');
Example 24.2. Executing the metastore.add_storage stored procedure (S3 storage)
SELECT metastore.add_storage('s3_storage_example', 's3://demo/s3_storage_example/','s3://demo/s3_storage_example/tmp/');
For an S3 storage connection scenario, refer to Section 24.3.