DEFINE SCHEMA target_schema FROM TABLE - response (12) by feinholz
DEFINE SCHEMA target_schema FROM TABLE - response (13) by Donald.Iuppa@teoco.com
Hi, No actually I reading from a file and writing to a teradata table. It just happens that the file layout will match the Teradata table schema (althought all delimited character) since I am porting to Teradata from an identical table schema. So I was hoping that I could just use the Teradata table layout to generate the schema for the file layout. When I saw the description of sourceFormat I thought that might do the trick .
DEFINE SCHEMA target_schema FROM TABLE - response (14) by feinholz
Then use this:
DEFINE SCHEMA EOD_USAGE DELIMITED FROM TABLE 'SONARTEST.EOD_USAGE';
That will convert the data types of the columns in the table schema to their equivalent VARCHAR data types (with appropriate sizes).
No need to use SourceFormat.
Teradata Parallel Transporter Wizard 13.10 Issues - response (19) by ragava.ece
My issue is also resolved after granting admin access to
C:\Program Files\Teradata\Client\14.10\Teradata Parallel Transporter\
Thank You Guys
TPT Wizard datatype casting - forum topic by ragava.ece
Since I am new to teradata my DBA suggested to use TPT Wizard to export data from a teradata table to a flat file in | delimited format.
However I noticed that all columns needed to be varchar for this export using TPT. Even though I changed the TPT Type to varchar I am getting below error,
W_0_o_Test_Cast: TPT12108: Output Schema does not match data from SELECT statement
Here is the script it generated,
/* 1 */
/* 2 */
/* 3 */ DEFINE JOB Test_Cast
/* 4 */ DESCRIPTION 'Test_Cast'
/* 5 */ (
/* 6 */ DEFINE OPERATOR W_1_o_Test_Cast
/* 7 */ TYPE DATACONNECTOR CONSUMER
/* 8 */ SCHEMA *
/* 9 */ ATTRIBUTES
/* 10 */ (
/* 11 */ VARCHAR FileName,
/* 12 */ VARCHAR Format,
/* 13 */ VARCHAR OpenMode,
/* 14 */ INTEGER BlockSize,
/* 15 */ INTEGER BufferSize,
/* 16 */ INTEGER RetentionPeriod,
/* 17 */ INTEGER RowsPerInstance,
/* 18 */ INTEGER SecondarySpace,
/* 19 */ INTEGER UnitCount,
/* 20 */ INTEGER VigilElapsedTime,
/* 21 */ INTEGER VigilWaitTime,
/* 22 */ INTEGER VolumeCount,
/* 23 */ VARCHAR AccessModuleName,
/* 24 */ VARCHAR AccessModuleInitStr,
/* 25 */ VARCHAR DirectoryPath,
/* 26 */ VARCHAR ExpirationDate,
/* 27 */ VARCHAR IndicatorMode,
/* 28 */ VARCHAR PrimarySpace,
/* 29 */ VARCHAR PrivateLogName,
/* 30 */ VARCHAR RecordFormat,
/* 31 */ VARCHAR RecordLength,
/* 32 */ VARCHAR SpaceUnit,
/* 33 */ VARCHAR TextDelimiter,
/* 34 */ VARCHAR VigilNoticeFileName,
/* 35 */ VARCHAR VigilStartTime,
/* 36 */ VARCHAR VigilStopTime,
/* 37 */ VARCHAR VolSerNumber,
/* 38 */ VARCHAR UnitType
/* 39 */ );
/* 40 */
/* 41 */ DEFINE SCHEMA W_0_s_Test_Cast
/* 42 */ (
/* 43 */ REC_ADD_TS VARCHAR(26)
/* 44 */ );
/* 45 */
/* 46 */ DEFINE OPERATOR W_0_o_Test_Cast
/* 47 */ TYPE EXPORT
/* 48 */ SCHEMA W_0_s_Test_Cast
/* 49 */ ATTRIBUTES
/* 50 */ (
/* 51 */ VARCHAR UserName,
/* 52 */ VARCHAR UserPassword,
/* 53 */ VARCHAR SelectStmt,
/* 54 */ INTEGER BlockSize,
/* 55 */ INTEGER MaxSessions,
/* 56 */ INTEGER MinSessions,
/* 57 */ INTEGER TenacityHours,
/* 58 */ INTEGER TenacitySleep,
/* 59 */ INTEGER MaxDecimalDigits,
/* 60 */ VARCHAR AccountID,
/* 61 */ VARCHAR DateForm,
/* 62 */ VARCHAR NotifyExit,
/* 63 */ VARCHAR NotifyExitIsDLL,
/* 64 */ VARCHAR NotifyLevel,
/* 65 */ VARCHAR NotifyMethod,
/* 66 */ VARCHAR NotifyString,
/* 67 */ VARCHAR PrivateLogName,
/* 68 */ VARCHAR TdpId,
/* 69 */ VARCHAR TraceLevel,
/* 70 */ VARCHAR WorkingDatabase
/* 71 */ );
/* 72 */
/* 73 */ APPLY
/* 74 */ TO OPERATOR
/* 75 */ (
/* 76 */ W_1_o_Test_Cast[1]
/* 77 */
/* 78 */ ATTRIBUTES
/* 79 */ (
/* 80 */ FileName = 'C:\Documents and Settings\****\Desktop\Test\cast.txt',
/* 81 */ Format = 'DELIMITED',
/* 82 */ OpenMode = 'Write',
/* 83 */ IndicatorMode = 'N',
/* 84 */ TextDelimiter = '|'
/* 85 */ )
/* 86 */ )
/* 87 */ SELECT * FROM OPERATOR
/* 88 */ (
/* 89 */ W_0_o_Test_Cast[1]
/* 90 */
/* 91 */ ATTRIBUTES
/* 92 */ (
/* 93 */ UserName = '****',
/* 94 */ UserPassword = '****',
/* 95 */ SelectStmt = 'SELECT REC_ADD_TS FROM TEST.Table;',
/* 96 */ TdpId = 'Server'
/* 97 */ )
/* 98 */ );
/* 99 */ );
Any suggestions?
TPT Wizard datatype casting - forum topic by ragava.ece
Since I am new to teradata my DBA suggested to use TPT Wizard to export data from a teradata table to a flat file in | delimited format.
However I noticed that all columns needed to be varchar for this export using TPT. Even though I changed the TPT Type to varchar I am getting below error,
W_0_o_Test_Cast: TPT12108: Output Schema does not match data from SELECT statement
Here is the script it generated,
/* 1 */
/* 2 */
/* 3 */ DEFINE JOB Test_Cast
/* 4 */ DESCRIPTION 'Test_Cast'
/* 5 */ (
/* 6 */ DEFINE OPERATOR W_1_o_Test_Cast
/* 7 */ TYPE DATACONNECTOR CONSUMER
/* 8 */ SCHEMA *
/* 9 */ ATTRIBUTES
/* 10 */ (
/* 11 */ VARCHAR FileName,
/* 12 */ VARCHAR Format,
/* 13 */ VARCHAR OpenMode,
/* 14 */ INTEGER BlockSize,
/* 15 */ INTEGER BufferSize,
/* 16 */ INTEGER RetentionPeriod,
/* 17 */ INTEGER RowsPerInstance,
/* 18 */ INTEGER SecondarySpace,
/* 19 */ INTEGER UnitCount,
/* 20 */ INTEGER VigilElapsedTime,
/* 21 */ INTEGER VigilWaitTime,
/* 22 */ INTEGER VolumeCount,
/* 23 */ VARCHAR AccessModuleName,
/* 24 */ VARCHAR AccessModuleInitStr,
/* 25 */ VARCHAR DirectoryPath,
/* 26 */ VARCHAR ExpirationDate,
/* 27 */ VARCHAR IndicatorMode,
/* 28 */ VARCHAR PrimarySpace,
/* 29 */ VARCHAR PrivateLogName,
/* 30 */ VARCHAR RecordFormat,
/* 31 */ VARCHAR RecordLength,
/* 32 */ VARCHAR SpaceUnit,
/* 33 */ VARCHAR TextDelimiter,
/* 34 */ VARCHAR VigilNoticeFileName,
/* 35 */ VARCHAR VigilStartTime,
/* 36 */ VARCHAR VigilStopTime,
/* 37 */ VARCHAR VolSerNumber,
/* 38 */ VARCHAR UnitType
/* 39 */ );
/* 40 */
/* 41 */ DEFINE SCHEMA W_0_s_Test_Cast
/* 42 */ (
/* 43 */ REC_ADD_TS VARCHAR(26)
/* 44 */ );
/* 45 */
/* 46 */ DEFINE OPERATOR W_0_o_Test_Cast
/* 47 */ TYPE EXPORT
/* 48 */ SCHEMA W_0_s_Test_Cast
/* 49 */ ATTRIBUTES
/* 50 */ (
/* 51 */ VARCHAR UserName,
/* 52 */ VARCHAR UserPassword,
/* 53 */ VARCHAR SelectStmt,
/* 54 */ INTEGER BlockSize,
/* 55 */ INTEGER MaxSessions,
/* 56 */ INTEGER MinSessions,
/* 57 */ INTEGER TenacityHours,
/* 58 */ INTEGER TenacitySleep,
/* 59 */ INTEGER MaxDecimalDigits,
/* 60 */ VARCHAR AccountID,
/* 61 */ VARCHAR DateForm,
/* 62 */ VARCHAR NotifyExit,
/* 63 */ VARCHAR NotifyExitIsDLL,
/* 64 */ VARCHAR NotifyLevel,
/* 65 */ VARCHAR NotifyMethod,
/* 66 */ VARCHAR NotifyString,
/* 67 */ VARCHAR PrivateLogName,
/* 68 */ VARCHAR TdpId,
/* 69 */ VARCHAR TraceLevel,
/* 70 */ VARCHAR WorkingDatabase
/* 71 */ );
/* 72 */
/* 73 */ APPLY
/* 74 */ TO OPERATOR
/* 75 */ (
/* 76 */ W_1_o_Test_Cast[1]
/* 77 */
/* 78 */ ATTRIBUTES
/* 79 */ (
/* 80 */ FileName = 'C:\Documents and Settings\****\Desktop\Test\cast.txt',
/* 81 */ Format = 'DELIMITED',
/* 82 */ OpenMode = 'Write',
/* 83 */ IndicatorMode = 'N',
/* 84 */ TextDelimiter = '|'
/* 85 */ )
/* 86 */ )
/* 87 */ SELECT * FROM OPERATOR
/* 88 */ (
/* 89 */ W_0_o_Test_Cast[1]
/* 90 */
/* 91 */ ATTRIBUTES
/* 92 */ (
/* 93 */ UserName = '****',
/* 94 */ UserPassword = '****',
/* 95 */ SelectStmt = 'SELECT REC_ADD_TS FROM TEST.Table;',
/* 96 */ TdpId = 'Server'
/* 97 */ )
/* 98 */ );
/* 99 */ );
Any suggestions?
Teradata Parallel Transporter - queries - response (3) by Santanu84
Hi Feinholz
Thanks for your updates. They are really helpful.
Just for #3, I saw that kind of syntax somewhere on web. I guess that was only for shorter display purpose and I misinterpreted that. :-)
Thanks
Santanu
TPT Wizard datatype casting - response (1) by Jinesh
SelectStmt = 'SELECT REC_ADD_TS(VARCHAR(26)) FROM TEST.Table;',
Can I perform Delete and Insert in the same trigger - response (2) by terankit
Thanks Dnoeth. I was just thinking if we can have it in one trigger.
Thanks.
DEFINE SCHEMA target_schema FROM TABLE - response (15) by Donald.Iuppa@teoco.com
Thank you so much that is what I needed!
The correct syntax is:
DEFINE SCHEMA EOD_USAGE FROM TABLE DELIMITED 'SONARTEST.EOD_USAGE';
DEFINE SCHEMA target_schema FROM TABLE - response (16) by Donald.Iuppa@teoco.com
I'm sorry one more road block. Can I have the table name as a variable?
I tried a few ways to no avail.
DEFINE SCHEMA EOD_USAGE FROM TABLE DELIMITED @jobVar_TargetTable
DEFINE SCHEMA EOD_USAGE FROM TABLE DELIMITED ''' || @jobVar_TargetTable || '''
DEFINE SCHEMA EOD_USAGE FROM TABLE DELIMITED '' || @jobVar_TargetTable || ''
DEFINE SCHEMA target_schema FROM TABLE - response (17) by Donald.Iuppa@teoco.com
I see this exact example in the manual:
Example 1: Job Script with Simplified Syntax
DEFINE JOB PLOAD_JOB
DESCRIPTION 'PLOAD JOB'
(
/* Use the schema of the TargetTable for TPT_SCHEMA */
DEFINE SCHEMA TPT_SCHEMA DELIMITED @LoadTargetTable;
APPLY $INSERT @LoadTargetTable TO OPERATOR ($LOAD [@LoadInstances])
SELECT * FROM OPERATOR ($FILE_READER(TPT_SCHEMA) [@ReaderInstances]);
);
Obtaining Failed load records from TPT load - forum topic by Donald.Iuppa@teoco.com
I understand that ErrorTable1 has my bad load records in it but how can I get them back out.
The DataParcel column is defined as : Entire data record, as provided by the source producer operator.
When I use teradata SQL assistant and have it output the dataparcel to a file it appers to only be the leading lenght bytes and the column data in error.
I need to write these records back out to a file, in a more automated fashion anyway.
I need to know which input records are causing load issues, so I can provide the creater of the file with specifics about the bad records.
How is this normally accomplished?
Thank you.
Obtaining Failed load records from TPT load - response (1) by Donald.Iuppa@teoco.com
I see this question is related to another thread "bteq export and import for _ET dataparcel" : 20 Feb 2012 is there any utility that will dump the error table to a file?
I would also like to see the input record number added to the error table.
DEFINE SCHEMA target_schema FROM TABLE - response (18) by Donald.Iuppa@teoco.com
I guess I should add it doesn't work.
DEFINE SCHEMA target_schema FROM TABLE - response (19) by feinholz
You can put a job variable anywhere in the script you want.
We even have customers switching between the Update operator and the Stream operator and parameterizing the operator "type".
As in: DEFINE OPERATOR <some-name>
TYPE @my_protocol
. . . . .
So, yes you can use a job variable for the table name in the DEFINE SCHEMA.
In fact, we recommend it.
We recommend you use job variables for anything in the script that can change.
When you say "it does not work", please be more specific and include the job output, and version of TPT.
Obtaining Failed load records from TPT load - response (2) by feinholz
We are coming out with a utility to extract the data from the DataParcel field and write it out in readable format (delimited), if the original record was delimited. If the original record format was binary, then the data will be written out in its original form. This will be available in 15.0. It will be part of TPT (although the utility itself will be a standalone utility).
As for changes to the layout of the error table, right now there are no plans to change that.
TPT Wizard datatype casting - response (1) by ragava.ece
Can someone help with above issue?
Obtaining Failed load records from TPT load - response (3) by feinholz
Incidentally, just so you know (this is not a trade secret), the information in DataParcel is in the exact format that we send the data to Teradata. Thus, if your original file contained delimited records, the information in DataParcel is a series of VARCHAR fields (2-byte 'n', followed by 'n' bytes, for each field). If the data was loaded by TPT, then each record begins with a 2-byte row length, followed by the indicator bytes, followed by the data. If the format of the input records was binary, then the data portion will be the exact data record from the input file.
True, there are no record numbers (unless that is part of the data), but at least you know that there is no "trick" to the format of the data.
Obtaining Failed load records from TPT load - response (4) by Donald.Iuppa@teoco.com
Is there any method of outputing a file from a table with a varbyte field using any teradata utility ?
I think you may be confusing a few things.
"SourceFormat" describes what the data will look like as it arrives to the Data Connector operator as a file reader. Not the file writer.
If you are trying to export from Teradata and write the data in delimited format to a flat file, then your schema must match what it looks like in the Teradata table (and you do that with your DEFINE SCHEMA . . . FROM TABLE command.
If you want your data in delimited format, then just define the format in the DC operator (as a file writer) definition. If you would rather specify that on the command line (not sure why you would want to do this), then you use TargetFormat.