Guillaume Thomas
Guillaume Thomas

Reputation: 2310

Argument load_infile not recognized by _mysql library in python

Looking at _mysql documentation, i find:

help(_mysql.connection)
class connection(__builtin__.object)
...
load_infile
  int, non-zero enables LOAD LOCAL INFILE, zero disables

Then, i try to create a connection and i have :

python> _mysql.connection(host = ..., db = ..., user = ..., passwd = ..., load_infile = 1)
TypeError                                 Traceback (most recent call last)
<ipython-input-23-e3878d45fb4e> in <module>()
----> 1 _mysql.connection(host = ..., db = ..., user = ..., passwd = ..., load_infile = 1)
TypeError: 'load_infile' is an invalid keyword argument for this function

What am i missing ?

Fyi:

In [25]: _mysql.version_info
Out[25]: (1, 2, 3, 'final', 0)

In [26]: _mysql.get_client_info()
Out[26]: '6.0.0'

Upvotes: 0

Views: 165

Answers (1)

Johann Bosman
Johann Bosman

Reputation: 713

I assume you are trying this because of the error :

_mysql_exceptions.OperationalError: (1148, 'The used command is not allowed with this MySQL version')

I also struggled with this for hours but finally found a solution : MySQLdb.connect(server, username, password, database, cursorclass = MySQLdb.cursors.DictCursor, local_infile = 1)

I know your question was about _mysql and not MySQLdb, but as per mata's comment you should not use _mysql

Upvotes: 1

Related Questions