DEFINE SCHEMA schema_name FROM SELECT OF OPERATOR operator_name not working with TPT Export to file

Tools

DEFINE SCHEMA schema_name FROM SELECT OF OPERATOR operator_name not working with TPT Export to file

Hi,

I am trying to write a generic TPT EXPORT script which will take the SQL query and export the data into flat file in a delimited format.

I used follwing TPT script with hard codes values to test with one table.

USING CHARACTER SET UTF8
DEFINE JOB export_emea_analytics_eu_deal_flat(

DEFINE SCHEMA emea_analytics_eu_deal_flat__schema FROM SELECT DELIMITED OF OPERATOR tpt_reader;

DEFINE OPERATOR tpt_reader
DESCRIPTION 'TERADATA PARALLEL TRANSPORTER EXPORT OPERATOR'
TYPE EXPORT
SCHEMA emea_analytics_eu_deal_flat__schema
ATTRIBUTES
(

VARCHAR USERNAME = 'user'

,VARCHAR SELECTSTMT = 'SELECT refund_rate_pc FROM emea_analytics.eu_deal_flat WHERE country_id=103 AND deal_id=546054;'

,VARCHAR USERPASSWORD = '********'

,VARCHAR TDPID = 'ip-address'

,VARCHAR QUERYBANDSESSINFO = 'workflow_path=/home/ramsubramani/dev/test;start_time=2014-07-02 17:44:23.458005;pid=26507;workflow_id=80fa23d2-0210-11e4-b6d6-002590733ca8;task_name=test/simple_export;date_id=2014-07-02;job_name=unknown;'

);

DEFINE OPERATOR tpt_writer
DESCRIPTION 'TERADATA PARALLEL TRANSPORTER FLAT FILE WRITER'
TYPE DATACONNECTOR CONSUMER
SCHEMA *
ATTRIBUTES
(

VARCHAR OPENMODE = 'Write'

,VARCHAR TEXTDELIMITERHEX = '01'

,VARCHAR DIRECTORYPATH = '/home/ramsubramani/dev/test/'

,VARCHAR INDICATORMODE = 'N'

,VARCHAR FILENAME = 'test.csv'

,VARCHAR QUOTEDDATA = 'N'

,VARCHAR FORMAT = 'DELIMITED'

,INTEGER BUFFERSIZE = 524288

);
APPLY TO OPERATOR (tpt_writer)
SELECT * FROM OPERATOR (tpt_reader);
);

STDOUT:

Teradata Parallel Transporter Version 14.10.00.03

Job log: /opt/teradata/client/14.10/tbuild/logs/emea_analytics.eu_deal_flat1-1041.out

Job id is emea_analytics.eu_deal_flat1-1041, running on pit-dev-script0801

Found CheckPoint file: /opt/teradata/client/14.10/tbuild/checkpoint/emea_analytics.eu_deal_flat1LVCP

This is a restart job; it restarts at step MAIN_STEP.

Teradata Parallel Transporter tpt_writer: TPT19006 Version 14.10.00.03

tpt_writer Instance 1 directing private log report to 'dtacop-ramsubramani-690-1'.

tpt_writer: TPT19007 DataConnector Consumer operator Instances: 1

Teradata Parallel Transporter Export Operator Version 14.10.00.03

tpt_reader: private log not specified

tpt_writer: TPT19003 ECI operator ID: 'tpt_writer-690'

tpt_writer: TPT19222 Operator instance 1 processing file '/home/ramsubramani/dev/test/test.csv'.

tpt_reader: connecting sessions

TPT_INFRA: TPT02639: Error: Conflicting data type for column(1) - "refund_rate_pc". Source column's data type (VARCHAR) Target column's data type (DECIMAL).

tpt_reader: TPT12108: Output Schema does not match data from SELECT statement

tpt_reader: disconnecting sessions

tpt_reader: Total processor time used = '0.15 Second(s)'

tpt_reader: Start : Wed Jul  2 18:29:50 2014

tpt_reader: End   : Wed Jul  2 18:29:55 2014

tpt_writer: TPT19221 Total files processed: 0.

Job step MAIN_STEP terminated (status 12)

Job emea_analytics.eu_deal_flat1 terminated (status 12)

Job start: Wed Jul  2 18:29:48 2014

Job end:   Wed Jul  2 18:29:55 2014

I am not sure what is going wrong.