pyodbc icon indicating copy to clipboard operation
pyodbc copied to clipboard

set statement attributes

Open iloveitaly opened this issue 1 year ago • 3 comments
trafficstars

You can set connection-level attributes via set_attr but not cursor-level settings. Note that I haven't had time for tests here yet, but can put them together if adding this to the project makes sense.

  • fix: set timeout before attempting connection timeout
  • feat: adding set_attr to cursor

iloveitaly avatar Jan 08 '24 21:01 iloveitaly

It does seem like a missing piece of the API - thanks. Could you add at least one test for PostgreSQL, MySQL, or SQL Server?

I'm also curious about the impetus for this. Were you looking for a statement timeout?

mkleehammer avatar Feb 05 '24 15:02 mkleehammer

I really like this idea.

I really appreciate the note in the doc string that only integers are supported right now. That will help a lot.

mkleehammer avatar Feb 27 '24 17:02 mkleehammer

This could be useful for setting SQL_ATTR_ENABLE_AUTO_IPD statement attribute as well.

eramitmittal avatar Mar 01 '24 03:03 eramitmittal