Ошибка работы с MySQL & Python 3.x

Когда запускаю код python с этой командой для MySQL

'INSERT INTO `message` (from_user, code, type, to_user, to_group, message_text, ip, port, country, city, checked) VALUES(\'' + message['from_user'] + '\', ' + message['code'] + ', ' + message['type'] + ', \'' + message['to_user'] + '\' ,' + False + ', \'' + message['text'] + '\' , \'' + message['ip'] + '\' ,' + message['port'] + ', \'' + message['country'] + '\', \'' + message['city'] + '\', ' +  False + ')'

то вылетает ошибка:

TabError: inconsistent use of tabs and spaces in indentation

Код:

try:
    with connection.cursor() as cursor:
    # SQL
    sql = 'INSERT INTO message (from_user, code, type, to_user, to_group, message_text, ip, port, country, city, checked) VALUES(\'' + message['from_user'] + '\', ' + message['code'] + ', ' + message['type'] + ', \'' + message['to_user'] + '\' ,' + False + ', \'' + message['text'] + '\' , \'' + message['ip'] + '\' ,' + message['port'] + ', \'' + message['country'] + '\', \'' + message['city'] + '\', ' +  False + ')'
    # Выполнить команду запроса (Execute Query
    cursor.execute(sql)
finally:
    # Закрыть соединение (Close connection).
    connection.close()

В чем ошибка, и есть какие есть ошибки?

p.s: MySQL

  id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  from_user VARCHAR(30) NOT NULL,
  code INT NOT NULL,
  type INT NOT NULL,
  to_user VARCHAR(30) NOT NULL,
  to_group BOOLEAN NOT NULL,
  message_text MEDIUMTEXT NOT NULL,
  ip TEXT NOT NULL,
  port INT UNSIGNED NOT NULL,
  country VARCHAR(3) NOT NULL,
  city TEXT NOT NULL,
  checked BOOLEAN NOT NULL

И есть ли какие-то другие ошибки?


Ответы (0 шт):