mysql.connector.errors.ProgrammingError: 1103 (42000)

时间:2017-06-15 10:22:05

标签: mysql-python

I get the following error while executing this query in mysql:

'create table DDB_CHANGE_via_mailbox_iocb_modifier_0x1_device_id_0x2_state_0x23_tran_up_error_0x0_flags_0x884e0000 (s_no int primary key not null, time varchar(25) not null, component varchar(50) not null, message varchar(255) not null, complete_id int not null)'

Error:

Traceback (most recent call last): File "", line 1, in File "C:\Python34\lib\site-packages\mysql\connector\cursor.py", line 559, in execute self._handle_result(self._connection.cmd_query(stmt)) File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 494, in cmd_query result = self._handle_result(self._send_cmd(ServerCmd.QUERY, query)) File "C:\Python34\lib\site-packages\mysql\connector\connection.py", line 396, in _handle_result raise errors.get_exception(packet) mysql.connector.errors.ProgrammingError: 1103 (42000): Incorrect table name 'DDB_CHANGE_via_mailbox_iocb_modifier_0x1_device_id_0x2_state_0x23_tran_up_error_0x0_flags_0x884e0000

'

I am using xampp local host mysql and executing queries in python using mysql connector. Am i entering some character in the table name which is not allowed? I read somewhere that enclosing table name in backticks solves that problem. But I get the same error even after doing that.

Edit: Okay, apparently you can't have a table name of more than 64 characters which seems to be the problem in my case. Is there a workaround for this?

1 个答案:

答案 0 :(得分:0)

Try this :-

create table 'DDB_CHANGE_via_mailbox_iocb_modifier_0x1_device_id_0x2_state_0x23_tran_up_error_0x0_flags_0x884e0000' ( 's_no' int primary key not null, 'time' varchar(25) not null, 'component' varchar(50) not null, 'message' varchar(255) not null, 'complete_id' int not null)