0

I was using this teradata module and then I've changed to this new one.

The fact is, in the old one, it was easy to set queryband by setting queryBands parameter in udaExec.connect function. In this new module I was not able to find a simple way to set querybands as easy as in the old module.

Does anyone know the best way to achieve this?

Red
  • 26,798
  • 7
  • 36
  • 58
O Pardal
  • 647
  • 4
  • 21
  • 1
    Build a string with`SET QUERY_BAND='name1=value1;name2=value2;...;nameN=valueN;' FOR SESSION` statement and pass that to `.execute`. – Fred Jul 28 '20 at 22:53
  • I did this, I thought that could be a simpler way as in the old module, but I realize that this new module doesn't have the same dictionary approach for query_band neither a log to file feature – O Pardal Jul 28 '20 at 22:58
  • 1
    True, _teradatasql_ is strictly a driver. It doesn't include the wrapper with additional "DevOps features" in section 2 of the _teradata_ package document you linked above.. – Fred Jul 29 '20 at 16:53
  • I think you can gather your comments and write an answer. You've explained everything possible related to the question. Thanks – O Pardal Jul 30 '20 at 10:49

1 Answers1

1

The teradatasql package is strictly a driver. It doesn't include the wrapper with additional "DevOps features" listed in section 2 of the teradata (udaExec) package document you linked above.

You need to build a string with a SET QUERY_BAND='name1=value1;name2=value2;...;nameN=valueN;' FOR SESSION statement and pass that to .execute.

You could build that statement from a dictionary like tdodbc does, but there won't be any entries pre-populated (like ApplicationName, Version, ClientUser, etc.); you'd have to add those yourself if you want them.

c.execute("SET QUERY_BAND = '{};' FOR SESSION".format(";".join("{}={}".format(k,v) for k, v in queryBands.items())))
Fred
  • 1,916
  • 1
  • 8
  • 16