I need to create hundreds of tables. The table names are: abc_1, abc_2, abc_3...
I used execute to create them before, but I thought it was a bit slow, so now I thought about whether I could use executemany, and then I found that executemany would use single parameters for the parameters. enclosed in quotation marks,
>>cur.execute('''create table %s (id int(10));''',('abc_1',))
create table 'abc_1' ( #单引号抛出异常
>>cur.execute('''create table `%s` (id int(10));''',('abc_1',))
create table `'abc_'` ( #创建成功,但创建的表名多出两个单引号
But our library does not allow table names or field names to be enclosed in single quotes, resulting in a direct error.
Try removing the symbols before and after %s in your statement
create table
%s(id int(10));
.