mkleehammer
unread,Mar 18, 2009, 11:47:10 PM3/18/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to pyodbc
At this time, there isn't an established way to do so.
The ODBC way to do so would be to set SQL_ATTR_CONNECTION_TIMEOUT and/
or SQL_ATTR_LOGIN_TIMEOUT to the appropriate value before making the
call.
Here are some potential solutions:
Add another Python-ish keyword (timeout=xxx or connection_timeout=xxx)
Allow some of the connection attributes to be passed as constants:
connect(SQL_ATTR_CONNECTION_TIMEOUT=xxx). This is very open ended and
doesn't require new keywords all the time, but it isn't the most
readable. (Alternatively, we could munge them as long as pyodbc can
recognize them: connect(attr_connection_timeout=xxx). I'm not sure
that's any better, though.)
Provide a specific dictionary that these are passed in: connect(attrs=
{ SQL_ATTR_CONNECTION_TIMEOUT : x}). This looks worse, but does have
the advantage that you can pass in integer constants that pyodbc
doesn't know about, perhaps database-specific ones:
# I'm making this up, of course
ORACLE_ATTR_TIMEOUT = 999
cnxn = connect(cstring, attrs={ ORACLE_ATTR_TIMEOUT : 30 })
Thoughts on these? How great is the need? I'm looking to release
2.1.5 in a day or two.