db paramstyle for arrays

Discussion in 'Python' started by Lee Harr, Apr 5, 2004.

  1. Lee Harr

    Lee Harr Guest

    Is there a special DB API style for inserting array values in
    to a database?

    In postgres, the values needs to end up like ARRAY[1, 2, 3]
    so I am just putting the word ARRAY in to the query string
    like this:

    q = "INSERT INTO foo VALUES (ARRAY%(bar)s)" % {'bar': [1, 2, 3]}

    That works, but it seems to me there may be a better way.

    Thanks for your time.
    Lee Harr, Apr 5, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman
    Replies:
    5
    Views:
    30,534
    Chris Smith
    Jun 17, 2004
  2. Bob Parnes

    DBAPI Paramstyle

    Bob Parnes, Mar 24, 2005, in forum: Python
    Replies:
    6
    Views:
    466
    Andy Dustman
    Mar 28, 2005
  3. BartlebyScrivener

    curious paramstyle qmark behavior

    BartlebyScrivener, Oct 20, 2006, in forum: Python
    Replies:
    7
    Views:
    347
    Jon Clements
    Oct 21, 2006
  4. Daniel
    Replies:
    3
    Views:
    440
    Thorsten Kampe
    Nov 11, 2008
  5. Philipp
    Replies:
    21
    Views:
    1,106
    Philipp
    Jan 20, 2009
Loading...

Share This Page