Teradata / PyTd

A Python Module to make it easy to script powerful interactions with Teradata Database in a DevOps friendly way.
MIT License
108 stars 43 forks source link

UdaExecConnection.executemany returns only the last result #71

Open dclong opened 7 years ago

dclong commented 7 years ago

I think it's best to keep all result sets. For example if one runs a parameterized select statement using the executemany method, he definitely wants to keep all results rather than only the last one.

escheie commented 7 years ago

Interesting request! I didn't expect executemany to be used for selects as its use is intended for batch inserts. The Python DB API Specification states:

Use of this method [executemany] for an operation which produces one or more result sets constitutes undefined behavior, and the implementation is permitted (but not required) to raise an exception when it detects that a result set has been created by an invocation of the operation.

I'll need to check if Teradata ODBC or Teradata REST supports this functionality. That fact that it doesn't work currently makes me suspect no but I'll need to do more investigation to confirm.

The workaround, as I'm sure you've already gathered, is to submit individual select statements.