找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 1756|回复: 0

[求助] 求助,使用pymysql写表达式总是出错,感谢

3

主题

3

帖子

3

积分

贫民

积分
3
BellaKids 发表于 2020-5-30 16:46:05 | 显示全部楼层 |阅读模式
使用pymysql连接数据库时报1064错误,具体代码如下:
name1 = str(date.today())
sql_create_table = '''create table %s''' % name1 + '''(id int not null primary key, company_id int,
channel_name varchar(45), in_tele_no varchar(45), out_tele_no varchar(45) )'''cursor_create_table.execute(sql_create_table)
错误信息如下:(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 '2020-05-30
日期前总会有一个单引号,尝试将name1设置为其他值,发现如果为数字加英文,可以正常执行,如“1abc”, 但如果为全数字,同样报1064,并且也是在数字前会有一个单引号,求助各位大神,感谢
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表