Usage Examples

Renaming

Example 1: Rename parameter

For this example we’ll be using the command line tool fd. You might need to install it (sudo apt install fd-find).

  1. Get a root shell:

    $ sudo bash
    
  2. Create a renaming landing zone (rlz):

    $ pool start-rename --what parameter rlz 'parameter_old' 'parameter_new'
    
  3. Replace parameter name in all conversion scripts:

    $ fd conversion rlz | xargs -n 1 sed -i"" -e "s/\bparameter_old\b/parameter_new/g"
    
  4. Run pool check:

    $ pool check rlz
    
  5. Update-operational:

    $ pool check rlz
    

Note

If pool check fails, you might want to check if you have empty files or broken raw files in your rlz.

find empty files to later delete them

fd -g 'data-*.raw' /data/development/rlz/data/ | xargs -n 1 wc -l | sort -n -r

Deletion

Example 1: Delete signals for a given source and time

  1. Dry run for delete signals out of the database:

$ pool delete-facts signals "source==fake_source_name" "timestamp>=2020-01-01 00:00:00"
  1. Execute the delete requires 2 –force flags and admin privileges root:

$ sudo pool delete-facts signals "source==fake_source_name" "timestamp>=2020-01-01 00:00:00" --force --force

Example 2: Delete many of signals for a given source and time

Delete large amounts of data. Due to the pre-collection of to delete signals the RAM can fill up for large quantities of data. One way to circumvent this is to loop over sections of the data. This example will delete all the data for the year 2020 for given source without any dry run!!.

for start in 2021-01-01 2020-10-01 2020-08-01 2020-06-01 2020-04-01 2020-02-01 2020-01-01 ; do
    echo "$start"
    sudo pool delete-facts signals "source==fake_source_name" "timestamp>$start"  --force --force
done;

Example 3: Delete Parameter for a given source and time

  1. Dry run for deleting an entity out of the database:

$ pool delete-entity --what parameter "parameter_name"
  1. Execute the delete requires 2 –force flags and admin privileges root:

$ sudo pool delete-entity --what parameter "parameter_name" --force --force