Bobspadger / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

pyodbc.connect method no longer handles autocommit passed as non-keyword argument #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call pyodbc.connect("DSN=MyDSN", True)
2.
3.

What is the expected output? What do you see instead?
This call worked with version 2.0.36. In 2.1.3, this error is the result:
TypeError: function takes at most 1 non-keyword argument

What version of the product are you using? On what operating system?
2.1.3, on Windows XP SP3

Please provide any additional information below.
According to the documentation, the method should support up to 3 non-
keyword args:
connect(str, autocommit=False, ansi=False, **kwargs)

Original issue reported on code.google.com by sal.scoz...@gmail.com on 22 Jan 2009 at 3:00

GoogleCodeExporter commented 9 years ago
An issue was recently opened here to request the kwargs, in order to match the 
DB API
better.  There were a couple of projects that would benefit from this 
(SQLAlchemy was
one, I believe).

The new method doesn't actually require the connection string (str).  To allow 
the
keywords to be passed in any order, I've removed the special parameters 
'autocommit'
and 'ansi' and simply look for them in the keyword dictionary.

This does lose the ability to pass positional parameters, which I didn't 
actually
notice since I always pass them as keywords.  Now that it has been pointed out,
however, I think I would like to keep it as is.  I think it will be much more
readable and less restrictive.  For example, with the API as is, you make calls 
such as:

   connect(dsn='x', user='y', ansi=True)

I have updated the documentation to reflect this.  Thanks.  I hope this didn't 
cause
too much trouble.

Original comment by mkleehammer on 22 Jan 2009 at 4:56

GoogleCodeExporter commented 9 years ago

Original comment by mkleehammer on 21 Nov 2010 at 4:44