Defining a schema in a Job script - 6.5

Talend Job Script Reference Guide

author
Talend Documentation Team
EnrichVersion
6.5
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Real-Time Big Data Platform
task
Design and Development > Designing Jobs
EnrichPlatform
Talend CommandLine
Talend Studio
Use the addSchema {} function to define a schema in a Job script.

addSchema {} properties

Function/parameter Description Mandatory?

NAME

Give a name to the schema.

Yes

CONNECTOR

Type in the connection type of the schema, for example: FLOW, REJECT, and so on.

Yes

addColumn {}

Add a column to your schema and define its parameters:

  • NAME: Type in the label of the column.
  • TYPE: Type in the type of data contained in this column.
  • KEY (optional): Define the column as the primary key by setting this parameter to true.
  • NULLABLE (optional): Define the column as nullable by setting this parameter to true.
  • DEFAULTVALUE (optional): Type in the default value of the column if no value is retrieved at Job execution.
  • LENGTH (optional): Type in the length of the column.
  • PRECISION (optional): Defines the number of digits to the right of the decimal point.
  • COMMENT (optional): Type in any useful comment.

You can use this function to add as many columns as your schema needs.

Yes

Example

The following Job script example defines a schema for component tFileInputDelimited_1, which contains two columns: firstName and lastName, both of type String.

	addSchema {
		NAME: "tFileInputDelimited_1",
		CONNECTOR: "FLOW"
		addColumn {
			NAME: "firstName",
			TYPE: "id_String"
		}
		addColumn {
			NAME: "lastName",
			TYPE: "id_String"
		}
	}