ETL - Blocks

When OrientDB executes the ETL module, blocks in the ETL configuration define components to execute in the process. The ETL module in OrientDB supports the following types of blocks:

Let Blocks

In a "let" block, you can define variables to the ETL process context.

  • Component name: let

Syntax

Parameter Description Type Mandatory Default value
"name" Defines the variable name. The ETL process ignores any values with the $ prefix. string yes
"value" Defines the fixed value to assign. an
"expression" Defines an expression in the OrientDB SQL language to evaluate and assign. string

Examples

  • Assign a value to the file path variable

    1. {
    2. "let": {
    3. "name": "$filePath",
    4. "value": "/temp/myfile"
    5. }
    6. }
  • Concat the $fileName variable to the $fileDirectory to create a new variable for $filePath:

    1. {
    2. "let": {
    3. "name": "$filePath",
    4. "expression": "$fileDirectory.append($fileName )"
    5. }
    6. }

Code Block

In the "code" block, you can configure code snippets to execute in any JVM-supported languages. The default language is JavaScript.

  • Component name: code

Syntax

Parameter Description Type Mandatory Default value
"language" Defines the programming language to use. string Javascript
"code" Defines the code to execute. string yes

Examples

  • Execute a Hello, World! program in JavaScript, through the ETL module:

    1. {
    2. "code": {
    3. "language": "Javascript",
    4. "code": "print('Hello World!');"
    5. }
    6. }

Console Block

In a "console" block, you can define commands OrientDB executes through the Console.

  • Component name: console

Syntax

Parameter Description Type Mandatory Default value
"file" Defines the path to a file containing the commands you want to execute. string
"commands" Defines an array of commands, as strings, to execute in sequence. string array

Example

  • Invoke the console with a file containing the commands:

    1. {
    2. "console": {
    3. "file": "/temp/commands.sql"
    4. }
    5. }
  • Invoke the console with an array of commands:

    1. {
    2. "console": {
    3. "commands": [
    4. "CONNECT plocal:/temp/db/mydb admin admin",
    5. "INSERT INTO Account set name = 'Luca'"
    6. ]
    7. }
    8. }