我正在使用psycopg2将数据插入Postgresql数据库表中 库,但是插入命令出现错误。谁能帮我解决这个问题?
def t_b():
table = 'create table {} (Title serial,Link char(50),logo_link
char(50),Description Text)'.format(name)
cur.execute(table)
print("Table created :",name)
def insertion(name,data):
data_s = ",".join(data)
ins = 'insert into {} (Title,Link,logo_link,Description)values({})'.format(name,data_s)
cur.execute(ins)
conn.commit()
def main():
t_b("ONE")
dd = ('abc','123','INsyustriesz','<htt:ps>' )
insertion("ONE",dd)
if __name__ == '__main__':
main()
cur.execute()
并显示错误消息:
psycopg2.errors.SyntaxError: syntax error at or near ":"
LINE 1: ... logo_link,Description) values(abc,123,INsyustriesz,htt:ps)
并且未插入数据