EXECUTE DATA LOADER
EXECUTE DATA LOADER runs a data loader to load new files from a specified path.
EXECUTE DATA LOADER executes a data loader created with CREATE DATA LOADER. It attempts to load all files in the specifed location that have not already been loaded and that have not reached the retry limit. Executing the loader automatically commits the transaction.
Data loaders are excuted with COPY ABORT ON ERROR.
EXECUTE DATA LOADER runs the data loader once. To execute it periodically, you can use a scheduled stored procedure.
Each data loader has an associated monitoring table that records paths that were attempted and their outcomes. The table follows the following naming scheme:
v_data_loader.schema_loader-name
Syntax
EXECUTE DATA LOADER [schema.]name
[ FORCE RETRY ]
Arguments
schema
- Schema containing the data loader. The default schema is
public
. name
- Name of the data loader.
FORCE RETRY
- Ignore the retry limit.
Privileges
Read privileges to the source location.
Non-superuser:
- Owner or EXECUTE privilege on the data loader.
- Write privilege on the table.
Examples
Execute a data loader once:
=> EXECUTE DATA LOADER sales_dl;
Rows Loaded
-------------
5
(1 row)
Schedule a recurring execution:
=> CREATE SCHEDULE daily_load USING CRON '0 13 * * *';
--- statement must be quoted:
=> CREATE PROCEDURE dl_runner() as $$ begin EXECUTE 'EXECUTE DATA LOADER sales_dl'; end; $$;
=> CREATE TRIGGER t_load ON SCHEDULE daily_load EXECUTE PROCEDURE dl_runner() AS DEFINER;
See Automatic load for an extended example.