时间:2021-07-01 10:21:17 帮助过:21人阅读
inset into tb(k2,k1,name,age) values(%(k2)s,%(k1)s,%(name)s,%(age)s), 字典
def add_merchant(self, **kwargs): cursor = self.db_conn.connect() sql = """insert into merchant(%s) values(%s)""" key_list = [] value_list = [] for k, v in kwargs.items(): key_list.append(k) value_list.append(‘%%(%s)s‘ % k) sql = sql % (‘,‘.join(key_list), ‘,‘.join(value_list)) cursor.execute(sql, kwargs) self.db_conn.close()
Tornado中insert into sql语句的构造
标签:odi list rgs ems pre elf set bsp key