Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: mattAfter looking at this, the problem is not with session maintenance, it turns out the problem is due to a feature for pre-fetching the metadata for sqlSelect operators. If the SQL statement passed to the sqlSelect operator is a constant string, then the sqlSelect operator tries to pre-fetch the metadata for the query. This enables the sqlSelect statement to produce valid metadata on the output pin even in the case when the query is never actually executed, i.e. a zero input row scenario.
The problem arises because the table being selected from is a volatile temporary table that does not exist until the statements are executed, therefore it is throwing an error when trying to pre-fetch the metadata. The simple work-around is to make the select statement not a string constant.
So rewriting the statement from:
sqlSelect(1, "SQL....")
TO:
sqlSelect(1, ""+"SQL...")
Will solve the problem.
A bug will be filed to allow for configuration of the pre-fetch metadata behavior.
As a note, Teradata requires a commit after a DDL statement, so you'll either need to do an explicit commit i.e. sqlNonSelect("COMMIT") or set the CommitFrequency to 1.
Matt