LOAD DATA LOCAL INFILE: The used command is not allowed with this MySQL version

Bug #538261 reported by tormen
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
MySQL Connector/Python
Triaged
Wishlist
Unassigned

Bug Description

CLIENT-A:
python 3.1.1+ and mysql connector 0.1.3
Linux me-laptop 2.6.31-19-generic #56-Ubuntu SMP Thu Jan 28 02:39:34 UTC 2010 x86_64 GNU/Linux

CLIENT-B:
mysql Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (x86_64) using EditLine wrapper ;)

SERVER:
Server version: 5.1.39-ndb-7.0.9-cluster-gpl-log MySQL Cluster Server (GPL)
Linux oneohone 2.6.18-6-amd64 #1 SMP Fri Dec 12 05:49:32 UTC 2008 x86_64 GNU/Linux

CLIENT-A:
Gets this Exception + traceback:
( the first line is the output of a print(stmt) in the cursor.py file of python mysql connector! )
==================================================================
b'LOAD DATA LOCAL INFILE "/tmp/tmpBBITg8" INTO TABLE `testtable2` FIELDS
TERMINATED BY "," OPTIONALLY ENCLOSED BY \'\\"\''
Traceback (most recent call last):
  File "converters.py", line 240, in <module>
    fromValuesToTable(vals, 'test.testtable2', [ [ 'name', 'varchar(255)
not null' ], [ 'email', 'varchar(255)' ] ], GSO=GSO)
  File "converters.py", line 98, in fromValuesToTable
    c.execute('LOAD DATA LOCAL INFILE "%s" INTO TABLE `%s` FIELDS
TERMINATED BY "," OPTIONALLY ENCLOSED BY %s' % (f.name, table, '%s'),
[ quotedBy ] )
  File
"/home/someguy/git.api/api/company/src/company/dl/db/__init__.py", line
398, in rexecute
    res = self.baseClass.execute(self, operation, params)
  File
"/usr/local/lib/python3.1/dist-packages/mysql/connector/cursor.py", line
334, in execute
    res = self.db().protocol().cmd_query(stmt)
  File
"/usr/local/lib/python3.1/dist-packages/mysql/connector/protocol.py",
line 268, in cmd_query
    buf = self.conn().recv()[0]
  File
"/usr/local/lib/python3.1/dist-packages/mysql/connector/connection.py",
line 84, in recv
    self.protocol.is_error(buf)
  File
"/usr/local/lib/python3.1/dist-packages/mysql/connector/protocol.py",
line 142, in is_error
    self._handle_error(buf)
  File
"/usr/local/lib/python3.1/dist-packages/mysql/connector/protocol.py",
line 132, in _handle_error
    raise errors.get_mysql_exception(err.errno,err.errmsg)
mysql.connector.errors.NotSupportedError: 1148: The used command is not
allowed with this MySQL version
==================================================================

CLIENT-B:
Works fine:
==================================================================
mysql -h 10.10.10.101 -u brd -p
LOAD DATA LOCAL INFILE "/tmp/tmpBBITg8" INTO TABLE `testtable2` FIELDS
TERMINATED BY "," OPTIONALLY ENCLOSED BY '"';
Query OK, 0 rows affected (0.02 sec)
Records: 0 Deleted: 0 Skipped: 0 Warnings: 0

mysql> status
--------------
mysql Ver 14.14 Distrib 5.1.37, for debian-linux-gnu (x86_64) using
EditLine wrapper
...
==================================================================

I guess that should be a bug, right?

Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

The exception says it all: it's simply not (yet) supported.

Very valid workaround: You can easily read from the file, parse it, and make INSERT-statements in Python.

Changed in myconnpy:
importance: Undecided → Wishlist
status: New → Triaged
Revision history for this message
tormen (quickhelp) wrote :

I just wasn't sure. But I guess your right.
Thanks for the fast answer.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.