Hi Tony, Below is the sample rows from the data file and my actual TPT script:
Stg_Imd_Production_Company|tt1790885|Columbia Pictures||||||||
Stg_Imd_Production_Company|tt1790885|Annapurna Pictures||||||||
Stg_Imd_Country_Rating|tt1790885|us||R||||||
Stg_Imd_Production_Company|tt1790885|First Light Production||||||||
Stg_Imd_Country_Gross_BO|tt1790885|us|USD|95314281||||||
Stg_Imd_Award|tt1790885|Academy Awards, USA|2013|Oscar|Won|||1|Best Achievement in Sound Editing||
Stg_Imd_Award|tt1790885|Academy Awards, USA|2013|Oscar|Nominated|||2|Best Motion Picture of the Year||
Stg_Imd_Country_Rating|tt1790885|au||M||||||
Stg_Imd_Keyword|tt1790885|navy-seal|2|||||||
DEFINE JOB FILE_LOAD
DESCRIPTION 'Load 2 TD tables from a file'
(
DEFINE SCHEMA ImxLoad2_Schema
(
IN_Table_Name VARCHAR(30)
,IN_Imdb_Cd VARCHAR(255)
,IN_Imdb_Field_1 VARCHAR(1000)
,IN_Imdb_Field_2 VARCHAR(1000)
,IN_Imdb_Field_3 VARCHAR(1000)
,IN_Imdb_Field_4 VARCHAR(1000)
,IN_Imdb_Field_5 VARCHAR(1000)
,IN_Imdb_Field_6 VARCHAR(1000)
,IN_Imdb_Field_7 VARCHAR(1000)
,IN_Imdb_Field_8 VARCHAR(1000)
,IN_Imdb_Field_9 VARCHAR(3500)
);
DEFINE OPERATOR DDL_OPERATOR
TYPE DDL
ATTRIBUTES
(
VARCHAR PrivateLogName = 'ddl_log1',
VARCHAR TdpId = @jobvar_tdpid,
VARCHAR UserName = @jobvar_username,
VARCHAR UserPassword = @jobvar_password,
VARCHAR ErrorList = '3807'
);
DEFINE OPERATOR FILE_READER
TYPE DATACONNECTOR PRODUCER
SCHEMA ImxLoad2_Schema
ATTRIBUTES
(
VARCHAR PrivateLogName = 'dataconnector_log1',
VARCHAR DirectoryPath = '%DDATADIR%',
VARCHAR FileName = 'imdb.dat',
VARCHAR Format = 'Delimited',
VARCHAR OpenMode = 'Read',
VARCHAR TextDelimiter ='|'
);
DEFINE OPERATOR UPDATE_OPERATOR
TYPE UPDATE
SCHEMA *
ATTRIBUTES
(
VARCHAR ARRAY TargetTable = ['staging_dev.Stg_Imd_Award','staging_dev.Stg_Imd_Production_Company'],
VARCHAR TdpId = @jobvar_tdpid,
VARCHAR UserName = @jobvar_username,
VARCHAR UserPassword = @jobvar_password,
VARCHAR LogTable = 'ERRORSDB_DEV.LG_ImxLoad2',
VARCHAR PrivateLogName = 'update_log'
);
APPLY
CASE
WHEN IN_Table_Name = 'Stg_Imd_Award'
THEN 'INSERT INTO staging_dev.Stg_Imd_Award
(Imdb_Title_Cd
,Awarding_Entity
,Award_Year
,Award
,Results
,Year_Order
,Year_Order_Name
,Award_Sequence
,Category
,Comments)
VALUES(:Imdb_Cd
,:IN_Imdb_Field_1
,:IN_Imdb_Field_2
,:IN_Imdb_Field_3
,:IN_Imdb_Field_4
,:IN_Imdb_Field_5
,:IN_Imdb_Field_6
,:IN_Imdb_Field_7
,:IN_Imdb_Field_8
,:IN_Imdb_Field_9)
;'
WHEN IN_Table_Name = 'Stg_Imd_Production_Company'
THEN
'INSERT INTO staging_dev.Stg_Imd_Production_Company
(Imdb_Title_Cd
,Production_Company
,Notes
)
VALUES (:IN_Imdb_Cd
,:IN_Imdb_Field_1
,:IN_Imdb_Field_2)
;'
END
IGNORE DUPLICATE INSERT ROWS
TO OPERATOR (UPDATE_OPERATOR[2])
SELECT * FROM OPERATOR (FILE_READER[2]);
);
Error: TPT_INFRA: Syntax error at or near line 113 of Job Script File imxLoad1.tpt.run:
TPT_INFRA: At "APPLY"
Compilation failed due to errors. Execution Plan was not generated.
This is how i defined the record layout in my old Multi-old script:
.LAYOUT Imd_Record_Layout;
.FILLER Table_Name 1 VARCHAR(30);
.FIELD Imdb_Cd * VARCHAR(255);
.FIELD Imdb_Field_1 * VARCHAR(1000);
.FIELD Imdb_Field_2 * VARCHAR(1000);
.FIELD Imdb_Field_3 * VARCHAR(1000);
.FIELD Imdb_Field_4 * VARCHAR(1000);
.FIELD Imdb_Field_5 * VARCHAR(1000);
.FIELD Imdb_Field_6 * VARCHAR(1000);
.FIELD Imdb_Field_7 * VARCHAR(1000);
.FIELD Imdb_Field_8 * VARCHAR(1000);
.FIELD Imdb_Field_9 * VARCHAR(3500);
Hi Tony, Below is the sample rows from the data file and my actual TPT script:
Stg_Imd_Production_Company|tt1790885|Columbia Pictures||||||||
Stg_Imd_Production_Company|tt1790885|Annapurna Pictures||||||||
Stg_Imd_Country_Rating|tt1790885|us||R||||||
Stg_Imd_Production_Company|tt1790885|First Light Production||||||||
Stg_Imd_Country_Gross_BO|tt1790885|us|USD|95314281||||||
Stg_Imd_Award|tt1790885|Academy Awards, USA|2013|Oscar|Won|||1|Best Achievement in Sound Editing||
Stg_Imd_Award|tt1790885|Academy Awards, USA|2013|Oscar|Nominated|||2|Best Motion Picture of the Year||
Stg_Imd_Country_Rating|tt1790885|au||M||||||
Stg_Imd_Keyword|tt1790885|navy-seal|2|||||||
DEFINE JOB FILE_LOAD
DESCRIPTION 'Load 2 TD tables from a file'
(
DEFINE SCHEMA ImxLoad2_Schema
(
IN_Table_Name VARCHAR(30)
,IN_Imdb_Cd VARCHAR(255)
,IN_Imdb_Field_1 VARCHAR(1000)
,IN_Imdb_Field_2 VARCHAR(1000)
,IN_Imdb_Field_3 VARCHAR(1000)
,IN_Imdb_Field_4 VARCHAR(1000)
,IN_Imdb_Field_5 VARCHAR(1000)
,IN_Imdb_Field_6 VARCHAR(1000)
,IN_Imdb_Field_7 VARCHAR(1000)
,IN_Imdb_Field_8 VARCHAR(1000)
,IN_Imdb_Field_9 VARCHAR(3500)
);
DEFINE OPERATOR DDL_OPERATOR
TYPE DDL
ATTRIBUTES
(
VARCHAR PrivateLogName = 'ddl_log1',
VARCHAR TdpId = @jobvar_tdpid,
VARCHAR UserName = @jobvar_username,
VARCHAR UserPassword = @jobvar_password,
VARCHAR ErrorList = '3807'
);
DEFINE OPERATOR FILE_READER
TYPE DATACONNECTOR PRODUCER
SCHEMA ImxLoad2_Schema
ATTRIBUTES
(
VARCHAR PrivateLogName = 'dataconnector_log1',
VARCHAR DirectoryPath = '%DDATADIR%',
VARCHAR FileName = 'imdb.dat',
VARCHAR Format = 'Delimited',
VARCHAR OpenMode = 'Read',
VARCHAR TextDelimiter ='|'
);
DEFINE OPERATOR UPDATE_OPERATOR
TYPE UPDATE
SCHEMA *
ATTRIBUTES
(
VARCHAR ARRAY TargetTable = ['staging_dev.Stg_Imd_Award','staging_dev.Stg_Imd_Production_Company'],
VARCHAR TdpId = @jobvar_tdpid,
VARCHAR UserName = @jobvar_username,
VARCHAR UserPassword = @jobvar_password,
VARCHAR LogTable = 'ERRORSDB_DEV.LG_ImxLoad2',
VARCHAR PrivateLogName = 'update_log'
);
APPLY
CASE
WHEN IN_Table_Name = 'Stg_Imd_Award'
THEN 'INSERT INTO staging_dev.Stg_Imd_Award
(Imdb_Title_Cd
,Awarding_Entity
,Award_Year
,Award
,Results
,Year_Order
,Year_Order_Name
,Award_Sequence
,Category
,Comments)
VALUES(:Imdb_Cd
,:IN_Imdb_Field_1
,:IN_Imdb_Field_2
,:IN_Imdb_Field_3
,:IN_Imdb_Field_4
,:IN_Imdb_Field_5
,:IN_Imdb_Field_6
,:IN_Imdb_Field_7
,:IN_Imdb_Field_8
,:IN_Imdb_Field_9)
;'
WHEN IN_Table_Name = 'Stg_Imd_Production_Company'
THEN
'INSERT INTO staging_dev.Stg_Imd_Production_Company
(Imdb_Title_Cd
,Production_Company
,Notes
)
VALUES (:IN_Imdb_Cd
,:IN_Imdb_Field_1
,:IN_Imdb_Field_2)
;'
END
IGNORE DUPLICATE INSERT ROWS
TO OPERATOR (UPDATE_OPERATOR[2])
SELECT * FROM OPERATOR (FILE_READER[2]);
);
Error: TPT_INFRA: Syntax error at or near line 113 of Job Script File imxLoad1.tpt.run:
TPT_INFRA: At "APPLY"
Compilation failed due to errors. Execution Plan was not generated.
This is how i defined the record layout in my old Multi-old script:
.LAYOUT Imd_Record_Layout;
.FILLER Table_Name 1 VARCHAR(30);
.FIELD Imdb_Cd * VARCHAR(255);
.FIELD Imdb_Field_1 * VARCHAR(1000);
.FIELD Imdb_Field_2 * VARCHAR(1000);
.FIELD Imdb_Field_3 * VARCHAR(1000);
.FIELD Imdb_Field_4 * VARCHAR(1000);
.FIELD Imdb_Field_5 * VARCHAR(1000);
.FIELD Imdb_Field_6 * VARCHAR(1000);
.FIELD Imdb_Field_7 * VARCHAR(1000);
.FIELD Imdb_Field_8 * VARCHAR(1000);
.FIELD Imdb_Field_9 * VARCHAR(3500);