Load data into a Database Table from Json
Activity | sqlInsertFromJSON |
---|---|
Description | Load data into a Database Table from JSON |
Input :
PropertyName | Type | Required | Default Value | Description |
---|---|---|---|---|
connectionName | STRING | YES | name of the source connection (see DbStore) | |
TableName | STRING | YES | the table name | |
SchemaName | STRING | NO | the schema name | |
FileToken | URL | NO | The file token containing the JSON file (must be either an JSON Array or an JSON Object) | |
JSON | JSON | NO | The JSON to load (must be either an JSON Array or an JSON Object)
| |
JSONColumn | STRING | NO | Name of the column that will contain the complete JSON | |
Columns | DICTIONARY | NO | Mapping between columns and JSON properties Starting from 1.4.11, The Value can be a JSONPath If not specified, the properties name of the JSON will be used as column name and the property values as values. (if it’s an array, the first item will be used as a template) |
Output
The insert query
Example1: Insert inner JSON into a table
Input
{
"connectionName": "dbStore1",
"tableName": "table1",
"schemaName" : "stg",
"JSONColumn": "js",
"JSON":[
{"firstname":"Bob","lastname":"Marley"},
{"firstname":"Frank","lastname":"Zappa"},
{"firstname":"Billie","lastname":"Holiday"},
],
"columns":{
"name":"firstname",
"lastname":"$.lastname"
}
}
Output
INSERT INTO stg.table1 (js,name,lastname) VALUES(@js,@p1,@p2)