mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.88k stars 561 forks source link

set statement attributes #1315

Open iloveitaly opened 5 months ago

iloveitaly commented 5 months ago

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.

mkleehammer commented 4 months ago

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 commented 4 months ago

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.

eramitmittal commented 4 months ago

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