简体   繁体   English

1064, "你的 SQL 语法有错误

[英]1064, "You have an error in your SQL syntax

Here is the error:这是错误:

gutschy@kiste:~/pizza/pizza_daten$ python datenimport3.py
Traceback (most recent call last):
  File "datenimport3.py", line 20, in <module>
    ")
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''Adressliste_forum1_v4.csv'            INTO TABLE pizzeria_table             FIE' at line 1")
gutschy@kiste:~/pizza/pizza_daten$

Here the datenimport3.py这里的 datenimport3.py

#!/usr/bin/python
#-*- coding: utf-8 -*-

import MySQLdb as mdb

con = mdb.connect('localhost', 'user', 'passw', 'pizzadb2');

with con:

    cur = con.cursor(mdb.cursors.DictCursor)
    cur.execute(" 'Adressliste_forum1_v4.csv'\
            INTO TABLE pizzeria_table \
            FIELDS TERMINATED BY ',' \
            ENCLOSED BY '\"' \
            LINES TERMINATED BY '\\n'  \
            IGNORE 1 LINES \
            (laden_name, vorwahl, telenr1, strasse, hausnr, \
            ort, linkname1, linkname2, linkname3, forum_link, \
            link2, link3, banner) \
            ")

Four month ago it works all fine, than I killed my debian 7 and now I'm on to bring it in the same way like before.四个月前它一切正常,比我杀死了我的 debian 7 现在我要像以前一样把它带来。 I've add the last field "banner" new but I've done noting more.我已经添加了最后一个字段“横幅”,但我已经注意到更多。

You can sort through all that traceback chaff by looking for this:您可以通过查找以下内容来整理所有追溯箔条:

...for the right syntax to use near ''Adressliste_forum1_v4.csv'  INTO ...

On a 1064 error, MySQL presents, right after "use near", your statement starting with the place where its parse error was found.在出现 1064 错误时,MySQL 会在“use near”之后立即显示您的语句,从发现其解析错误的位置开始。

Now, should not your statement start with现在,你的陈述不应该以

 LOAD DATA INFILE 'Adressliste_forum1_v4.csv'  INTO ...

? ?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM