Postgres/psycopg2 - Inserting array of strings

前端 未结 4 928
耶瑟儿~
耶瑟儿~ 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 02:57

    You have to let psycopg do parameters binding for you: don't try to quote them yourself.

    Psycopg automatically converts a python list of strings into a postgres array. Check http://initd.org/psycopg/docs/usage.html

提交回复
热议问题