From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | "Weatherby,Gerard" <gweatherby(at)uchc(dot)edu>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: execute_values |
Date: | 2019-07-09 20:25:03 |
Message-ID: | 83543627-3dc3-0a55-e23b-4f6dba55660f@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 7/9/19 11:04 AM, Weatherby,Gerard wrote:
> Can I use pyscopy2.extras.execute_values with a prepared statement?
I don't think so as you cannot pass in VALUES():
cur.execute('prepare pt(integer, varchar, boolean) AS INSERT INTO
prepare_test values ($1, $2, $3)')
execute_values(cur, 'EXECUTE pt(%s)', [(2, 'test', 'f'),])
SyntaxError: wrong number of parameters for prepared statement "pt"
DETAIL: Expected 3 parameters but got 1.
execute_batch works though:
execute_batch(cur, 'EXECUTE pt(%s, %s, %s)', [(2, 'test', 'f'), (3,
'dog', 't')])
>
>
> --
> *Gerard Weatherby*| Application Architect
> NMRbox | Department of Molecular Biology and Biophysics | UConn Health
> 263 Farmington Avenue, Farmington, CT 06030-6406
> Phone: 860 679 8484
> uchc.edu
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2019-07-09 21:15:15 | Re: REINDEX : new parameter to preserve current average leaf density as new implicit FILLFACTOR |
Previous Message | Christoph Bilz | 2019-07-09 20:00:06 | how to return rows of data via function written by language C strict |