pg.ddx.io pgsql-general@postgresql.org mailing list archivehelp / color / mirror / Atom feed
execute_values 4+ messages / 2 participants [nested] [flat]
* execute_values @ 2019-07-09 18:04 Weatherby,Gerard <gweatherby@uchc.edu> 0 siblings, 1 reply; 4+ messages in thread From: Weatherby,Gerard @ 2019-07-09 18:04 UTC (permalink / raw) To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org> ?Can I use pyscopy2.extras.execute_values with a prepared statement? -- 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 ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: execute_values @ 2019-07-09 20:25 Adrian Klaver <adrian.klaver@aklaver.com> parent: Weatherby,Gerard <gweatherby@uchc.edu> 0 siblings, 1 reply; 4+ messages in thread From: Adrian Klaver @ 2019-07-09 20:25 UTC (permalink / raw) To: Weatherby,Gerard <gweatherby@uchc.edu>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org> 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.klaver@aklaver.com ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: execute_values @ 2019-07-10 12:09 Weatherby,Gerard <gweatherby@uchc.edu> parent: Adrian Klaver <adrian.klaver@aklaver.com> 0 siblings, 1 reply; 4+ messages in thread From: Weatherby,Gerard @ 2019-07-10 12:09 UTC (permalink / raw) To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org> My insert has a "returning clause," I don't think execute batch supports that. -- 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 ________________________________________ From: Adrian Klaver <adrian.klaver@aklaver.com> Sent: Tuesday, July 9, 2019 4:25 PM To: Weatherby,Gerard; pgsql-general@lists.postgresql.org Subject: Re: execute_values 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.klaver@aklaver.com ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: execute_values @ 2019-07-10 14:27 Adrian Klaver <adrian.klaver@aklaver.com> parent: Weatherby,Gerard <gweatherby@uchc.edu> 0 siblings, 0 replies; 4+ messages in thread From: Adrian Klaver @ 2019-07-10 14:27 UTC (permalink / raw) To: Weatherby,Gerard <gweatherby@uchc.edu>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org> On 7/10/19 5:09 AM, Weatherby,Gerard wrote: > My insert has a "returning clause," I don't think execute batch supports that. Well it will execute, it just will not return the values to you:( What is your query and what are you doing with it? > > -- > 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 > > ________________________________________ > From: Adrian Klaver <adrian.klaver@aklaver.com> > Sent: Tuesday, July 9, 2019 4:25 PM > To: Weatherby,Gerard; pgsql-general@lists.postgresql.org > Subject: Re: execute_values > > 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.klaver@aklaver.com > -- Adrian Klaver adrian.klaver@aklaver.com ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2019-07-10 14:27 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-07-09 18:04 execute_values Weatherby,Gerard <gweatherby@uchc.edu> 2019-07-09 20:25 ` Adrian Klaver <adrian.klaver@aklaver.com> 2019-07-10 12:09 ` Weatherby,Gerard <gweatherby@uchc.edu> 2019-07-10 14:27 ` Adrian Klaver <adrian.klaver@aklaver.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox