29.1. Adding Parquet Files to an Analytical Table (metastore.add_files) #

Before performing this instruction, place Parquet files in a shared directory from the pga_folder metadata table.

Required privileges:

For more information about stored procedures and privileges, refer to Section 22.1.

Execute the following command:

  SELECT metastore.add_files('table_name', 'path_to_Parquet_files', 'path_to_JSON');

Where:

Postgres Pro AXE performs the following actions:

  1. Verifies input parameters and user privileges.

  2. Ensures metadata compatibility between Parquet files and the analytical table: the number, order, names, and types of columns must match.

  3. Creates new entries in pga_snapshot and pga_data_file metadata tables.

  4. Copies Parquet files to the storage directory of the analytical table, to a new subdirectory with the snapshot ID as the name.

    If Parquet files are added to a partitioned analytical table, they are split into multiple files based on partition columns, and a directory tree is created for these files.

  5. Updates statistics in pga_table_stats, pga_table_column_stats, and pga_file_column_statistics metadata tables.

Example 29.1. Executing the metastore.add_files stored procedure

  SELECT metastore.add_files('table_example', 'folder/file.parquet', 'folder/options.json');