[DB-SIG] PEP 249

INADA Naoki songofacandy at gmail.com
Tue Jun 28 05:02:06 EDT 2016


I'll support it in next version of mysqlclient.

On Fri, Jun 24, 2016 at 11:31 PM, Sigurd Jervelund Hansen
<sigurd at jervelund.com> wrote:
> Hi
>
> I'm using the PEP249 as a reference, and I've stumbled upon some
> contradicting documentation in footnote 1.
>
> If I attempt to connect to a database using the example I get the following
> error:
>
>>>> connect(host=dbHost,user=dbUser,password=dbPassword,database=dbName)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init__.py", line
> 81, in Connect
>     return Connection(*args, **kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line
> 193, in __init__
>     super(Connection, self).__init__(*args, **kwargs2)
> TypeError: 'database' is an invalid keyword argument for this function
>
> Changing parameter database to db:
>
>>>> connect(host=dbHost,user=dbUser,password=dbPassword,db=dbName)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/__init__.py", line
> 81, in Connect
>     return Connection(*args, **kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line
> 193, in __init__
>     super(Connection, self).__init__(*args, **kwargs2)
> TypeError: 'password' is an invalid keyword argument for this function
>
> Changing parameter password to passwd:
>
>>>> connect(host=dbHost,user=dbUser,passwd=dbPassword,db=dbName)
> <_mysql.connection open to 'mysql-host' at 217e660>
>
> In short: Parameter password should be passwd and database should be db.
>
> Direct link to footnote: https://www.python.org/dev/peps/pep-0249/#id40
> Link to stackoverflow with working example:
> http://stackoverflow.com/questions/372885/how-do-i-connect-to-a-mysql-database-in-python
>
> Best regards
> Sigurd J. Hansen
>
> _______________________________________________
> DB-SIG maillist  -  DB-SIG at python.org
> https://mail.python.org/mailman/listinfo/db-sig
>



-- 
INADA Naoki  <songofacandy at gmail.com>


More information about the DB-SIG mailing list