Postgres/psycopg2 - Inserting array of strings

前端 未结 4 968
耶瑟儿~
耶瑟儿~ 2020-12-30 02:27

I\'m using Postgres 9 and Python 2.7.2 along with psycopg2 and am trying to insert an array of string values with properly escaped quotation marks. Sample:

m         


        
4条回答
  •  忘掉有多难
    2020-12-30 03:11

    If you are going to dump the whole metadata as a string into the table, you can just do:

    cur.execute("insert into meta values (%s);", (str(metadata),))
    

提交回复
热议问题