Thank you feinholz. So I don't confuse anyone I thought I had a single script working to create a schema file and then use it via a include. I thought this was working but in reality it was using the existing file (previous run) before I recreated it.
I wish there was a way to differ this include until after I create the schema. For now I split this into two executions of tbuild.
I also had some copy and paste issues above so here is the working schema generation script:
Looking back at my intial approach:
DEFINE SCHEMA EOD_USAGE FROM TABLE 'SONARTEST.EOD_USAGE';
i got it sort of working by suplying the source login information on the command line.
my current error is:
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.
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 .
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.
Thank you so much that is what I needed!
The correct syntax is:
DEFINE SCHEMA EOD_USAGE FROM TABLE DELIMITED 'SONARTEST.EOD_USAGE';
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 || ''
I see this exact example in the manual:
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".
DEFINE OPERATOR <some-name>
. . . . .
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.