Built-in agents

Agent: init

Historical names: init

Runs SQL command on target database

Advice: write re-applyable SQL

Syntax and samples

 - do: run
   file: precheck.sql

Mentioned file must be inside same directory.

  • Advice: Make files names lowercase and without any "strange" characters (space, diacritical marks, etc). Keep it simple and survival. Lowercase in not mandatory, it just a good practice (in Linux similar uppercase and lowercase files can co-exists in same directory, in Windows this is not possible).

precheck.sql:

-- Mark syncing timestamp if not marked yet
UPDATE meta.registry
  SET synced_until_ts = '2024-01-01'
  WHERE task_id = 'from_arno.ods_arno.table_with_very_old_data'
  AND synced_until_ts IS NULL;

Tag "file" can be string or array of strings. In case of array files will be applied in defined order.

 - do: run
   file: 
    - precheck.sql
    - create.sql
    - index.sql

Remarks:

  • Changing during loading action some meta-tables, is not very good idea, but there are some use cases for that (eg. above example)
  • meta tables may by in schema "meta" or "bis" and may or may not have prefix "bis_", so in such use case be familiar with your version.
  • creating empty tables is not good idea, but you may do: create table as ... to create and fullfill table,
  • anyway don't forgot that SQL must be repeatable -- use IF NOT EXISTS or DROP IF EXISTS -- PostgreSQL support such actions on most of objects

init

jjtuke

shadow

jutuke

kolmas tase

kolmas tase 2

asdasdasd