pymysql.err.InternalError: 1075

pymysql.err.InternalError: (1075, ‘Incorrect table definition; there can be only one auto column and it must be defined as a key‘)


python中使用pymysql创建table是报错是上面标题,sql语句如下:
sql = ‘‘‘
create table music (
id int not null auto_increment,
song text,
singer text,
genre text,
issue text,
publisher text,
score text)‘‘‘
百度,问题是:自增字段必须是主键。解决办法是设置id为主键。
修改后sql为:
sql = ‘‘‘
create table music (
id int not null auto_increment,
song text,
singer text,
genre text,
issue text,
publisher text,
score text,
primary key(id)
)‘‘‘
感谢:https://www.cnblogs.com/guodongdidi/p/6290782.html

原文地址:https://blog.51cto.com/11575772/2438822

时间: 2024-10-11 07:01:03

pymysql.err.InternalError: 1075的相关文章

报错:pymysql.err.InternalError: (1054, "Unknown column 'AType' in 'field list'")

报错背景: 报错前sql代码展示: List = ['Manual', 'Float', 'TimeValue', 'None', '100', '100', '0', '0', '0', '0', 'Forced', '排水系统3#中央泵负压', '556', 'SLWS_ps_3hzybf_YL.PV', 'Analog', '2019/6/13 8:32:46', '-0.0034143477678299', '0'] # sql = "insert into test(id, name)

InternalError: (pymysql.err.InternalError) (1205, u'Lock wait timeout exceeded; try restarting transaction')

在mysql innodb中使用事务,如果插入或者更新出错,一定要主动显式地执行rollback,否则可能产生不必要的锁而锁住其他的操作 我们在使用数据库的时候,可以使用contextlib,这样异常的时候自动回滚,而且最后都会执行关闭操作 from contextlib import contextmanager engine = create_engine(EREBUS_DB_CONNECT_STRING, echo=True, pool_size=150, max_overflow=50,

pymysql.err.InternalError: (1054, "Unknown column 'None' in 'field list'")

错误提示: Traceback (most recent call last): File "D:/projectwc/test/dd.py", line 43, in <module> effect_row = cursor.execute("insert into `222` set c={}".format(None)) File "C:\python\lib\site-packages\pymysql\cursors.py",

pymysql.err.IntegrityError: (1062, &quot;Duplicate entry &#39;roxml-ROXML&#39; for key &#39;PRIMARY&#39;&quot;)

在<Python数据挖掘-概念.方法与实践>一书的第3章实体匹配中,如果一路按照作者的代码及SQL语句进行配置运行的话,会出现如题目所示的错误.根据python脚本的执行错误提示显示,错误发生在脚本中的第一个INSERT INTO语句中. 其实并不是到插入roxml时候才会报错,而是在前面插入optionparser的时候就已经报错了.这个错误意思是代码试图在表中主键列被插入两个重复值.这个问题耗费了我三个小时,才最终把它解决. 书中的第一个INSERT语句目的是要把具有相同URL的项目的项目

报错pymysql.err.DataError: (1406, &quot;Data too long for column &#39;gender&#39; at row 1&quot;)

在Django默认的admin后台创建超级用户时, 报错pymysql.err.DataError: (1406, "Data too long for column 'gender' at row 1")的解决方法. 创建过程为: 点击tool菜单的run manage.py task,输入createsuperuser,运行,按提示输入用户名,邮件,密码,以及密码确认. 解决方法为: 在pycharm中按快捷键ctr+h,查找到gender的相应字段,如图: 我们可以看到设置的ge

MySQL数据库报错pymysql.err.InterfaceError: (0, &#39;&#39;)

今天入库的时候出现了报错pymysql.err.InterfaceError: (0, ''),经过排查,发现是由于把连接数据库的代码放到了插入函数的外部,导致多线程运行出错 1 def write_into_db(data): 2 db = pymysql.connect(host=db_host, user=db_user, password=db_password, port=db_port, db=db_name, charset='utf8') 3 cursor = db.cursor

Python操作mysql数据库出现pymysql.err.ProgrammingError: (1064, &quot;You have an error in your SQL syntax; check

今天在用Python操作mysql数据库出现pymysql.err.ProgrammingError: (1064, "You have an error in your SQL syntax; check报错 "SELECT Failure_code,describe from failure_occur_now order by ID DESC LIMIT 1“黄色区域为报错的位置仔细查找,发现没有语法错误啊,后面将,describe删掉不报错了,原来describe应该是Mysq

mysql修改字段长度及pymysql.err.DataError: (1406, &quot;Data too long for column &#39;name&#39; at row 1&quot;)错误

文章链接:修改字段:https://blog.csdn.net/xiejunna/article/details/78580682 错误分析:https://blog.csdn.net/qq_42142258/article/details/82782237 修改字段长度类型:https://www.cnblogs.com/freeweb/p/5210762.html 向mysql 插入数据并能显示一条数据再报错:pymysql.err.DataError: (1406, "Data too l

mysql IntegrityError: (pymysql.err.IntegrityError) (1062, &quot;Duplicate entry &#39;000001.SZ-2018-07-02&#39; for key &#39;PRIMARY&#39;&quot;)

IntegrityError: (pymysql.err.IntegrityError) (1062, "Duplicate entry '000001.SZ-2018-07-02' for key 'PRIMARY'")[SQL: INSERT INTO stock_daily_basic (ts_code, trade_date, close, turnover_rate, turnover_rate_f, volume_ratio, pe, pe_ttm, pb, ps, ps_