Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field values from external commands #15

Closed
borisershov opened this issue Apr 23, 2024 · 3 comments
Closed

Field values from external commands #15

borisershov opened this issue Apr 23, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@borisershov
Copy link
Member

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

@borisershov borisershov added the enhancement New feature or request label Apr 23, 2024
@borisershov
Copy link
Member Author

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
Copy link
Member Author

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

  • The command's stdout will be used as a new value for the anonymized field
  • Command must return zero exit code, otherwise nxs-data-anonymizer will falls with error (in this case stderr will be used as an error text)
  • Environment variables with the row data are available within the command:
    • ENVVARTABLE: contains a name of the filtered table
    • ENVVARCURCOLUMN: contains the current column name
    • ENVVARCOLUMN_{COLUMN_NAME}: contains values (before substitutions) for all columns for the current row

@borisershov
Copy link
Member Author

Closed in Release v1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant