Focal Point
[SOLVED] Query Banding for Teradata

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5007016666

January 10, 2014, 10:02 AM
Spence
[SOLVED] Query Banding for Teradata
Has anyone used Query Banding with Teradata? So far I have not been able to enable the Query Band and execute SQL Passthru together. I can do each separately but not together. The second connection is removing the QUERY BAND from the first connection.

This will enable the Query Band:
SQL SQLDBC
SET QUERY_BAND='ClientUser=jdoe;' FOR SESSION;
END

This works for sql passthru:
SQL SQLDBC SET DEFAULT_CONNECTION devdss
SQL SQLDBC
select branch_id, branch_name order by 1 from dss_tables.branch;
TABLE FILE SQLOUT
PRINT *
END

Both are SQL statements that are terminated with a semi colon. The first SQL statement enables the QUERY BAND. The next SQL statement reads data from a table and has to have the SQL SQLDBC to connect to the table. The connection is removing the QUERY BAND from the first connection.

This message has been edited. Last edited by: <Kathryn Henning>,


WF 8 version 8.2.04. Windows.
In focus since 1990.
January 17, 2014, 02:16 PM
<Kathryn Henning>
Hi Spence,

Thank you for opening a case for this issue. Please keep us updated on the outcome.

Thanks and regards,

Kathryn
January 29, 2014, 01:44 PM
<Kathryn Henning>
Hi,

For those who find this topic on future searches, here is the resolution from the case.

The following passthru request at the top of the focexec will set QUERY_BANDING for the focexec:

SQL SQLDBC
SET QUERY_BAND='ClientUser=user_a;' FOR SESSION;
END

where 'user_a' is the user you want to set in the Query Banding. To show that the Query_band is being set correctly, add the following after it is set in the same focexec:

SQL SQLDBC HELP SESSION;
TABLE FILE SQLOUT PRINT
Transaction_Semantics
QueryBand
User_Name
Account_Name
Logon_Date
Logon_Time
Current_DataBase
END

Check the QueryBand column to confirm it is populated with 'user_a'.

Cheers!

Kathryn
February 04, 2014, 01:06 PM
Spence
To add to this topic Query Banding is being used to control user security to the Teradata tables.

The query banding required an END to be placed after each of the SQL queries. Without the END after the queries the Query Band was not set for the second query.

SQL SQLDBC SET DEFAULT_CONNECTION devdss
SQL SQLDBC
SET QUERY_BAND='proxyuser=&WF_REMOTE_USER;' FOR SESSION;
END

select count(branch_id) from datamart.branch_test;
END

TABLE FILE SQLOUT
PRINT *
END


WF 8 version 8.2.04. Windows.
In focus since 1990.