nixys / nxs-data-anonymizer

A tool for anonymizing PostgreSQL and MySQL databases' dump
Apache License 2.0
233 stars 10 forks source link

Field values from external commands #15

Closed borisershov closed 7 months ago

borisershov commented 7 months ago

Add an ability to create a field values from external commands.

borisershov commented 7 months ago

The solution of this issue will be represented as an additional type command of column value:


...

filters:
  some_table_name:
    columns:
      some_column_name:
        type: command
        value: /path/to/command/or/script.sh

...

If the type: command set for column, the value of the field value considered as path to command that will be executed every time for this field. An additional environment variables will be available within the runtime of the specified command:

ENVVARTABLE={TABLE_NAME}: contains a name of the filtered table ENVVARCOLUMN_{COLUMN_NAME}={COLUMN_VALUE}: contains all columns and its values (before substitutions) for the current filtered row

The stdout of the command considered as new value for the filtered field.

borisershov commented 7 months ago

As a result the command's concept has following properties:

borisershov commented 7 months ago

Closed in Release v1.4.0