20.1. Creating a Storage (metastore.add_storage) #

Before creating an S3 storage, 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 18.1.

Execute the following command on the Postgres Pro AXE server:

  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 (e.g., file:///home/j.doe/workspace/axe/).

S3 storages have URIs with more complicated structures and parsing (e.g., s3://premdb/team01.csv?versionId=w_B5qT8s5MkiT09.IRHay0lW.PycsHTS). These URIs are generated using third-party libraries.

Postgres Pro AXE performs the following actions:

  1. Checks input parameters and user privileges.

  2. Ensures that there is enough free space for the storage. By default, 10 GB is required.

  3. Ensures that the specified directories exist.

  4. Creates a new entry in the pga_storage metadata table.

Example 20.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 20.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 29.2.