15.1. Creating a Storage #

If you are planning to create an S3 storage, before performing this instruction, create a simple secret.

To create a storage, execute the following query:

  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 structure and parsing, for example, s3://premdb/team01.csv?versionId=w_B5qT8s5MkiT09.IRHay0lW.PycsHTS. These URIs are generated using third-party libraries.

Example 15.1. Creating a Local Storage

  SELECT metastore.add_storage('local_storage_example', 'file:///tmp/local_storage_example/', 'file:///tmp/local_storage_example/tmp_dir/');

Example 15.2. Creating an S3 Storage

  SELECT metastore.add_storage('s3_storage_example', 's3://demo/s3_storage_example/','s3://demo/s3_storage_example/tmp/');

Once the query is executed, pgpro_metastore performs the following actions:

  1. Verifies 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.

For more information about connecting to an S3 storage, refer to Appendix D.