|
使用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,并且也是在数字前会有一个单引号,求助各位大神,感谢
|
|