Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkwfr-0007Il-OZ for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 20:25:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hkwfp-0006Pi-CC for pgsql-general@arkaria.postgresql.org; Tue, 09 Jul 2019 20:25:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkwfo-0006PZ-5y for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2019 20:25:13 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hkwfk-0001CJ-Hz for pgsql-general@lists.postgresql.org; Tue, 09 Jul 2019 20:25:10 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 87BAB2242E; Tue, 9 Jul 2019 16:25:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 09 Jul 2019 16:25:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=I ezz2oN9Wi2enbqzqevLsNx0+ZXHuKQbyWAOh0bo72g=; b=v+v38JmjSBPC2bPV/ hRb+v9GZlth0LuKV2hNOhm9zV/EenTXkP0C0h6P2m3NjDjcjZ6xJKEuYCdnNl1sN fgel1bSek6mwSkyiixDsM/sKnHEjRArDLntKGYkYrC0UQuO3+5Kyj+ZbmAuSRi4q FIrFeQIys4mKYhNFP1/raauDr+DqOGX1u4vcuktc4c3HHDzhnA5fGKleoPe60qHF YAas4MoiXuYrzxWzwQNpgLZuIXmSULs8S5ihE91mkVNEg02UR9nnJXY3Mb5hE2TV PCeGdcQpYnMGltEFo2lqRqR73EYUE1q+tAKp0MTl/uUYVIkFAdmm3JM9J493jqWo r8J7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Iezz2oN9Wi2enbqzqevLsNx0+ZXHuKQbyWAOh0bo7 2g=; b=Rbhbgw20f9JQWmqMx6uzGxzcbZ8nNQ80w3IciqKV7bMecgq7X7vs4fcn0 Ye0PkXwDKl3bSWLpL+KKmVU4j/Bku1QZPkjW0x8zLJLLB9MVQhcjZVZYC0Mr/nCQ p4H5pmCH3+F8Y+NoPMrO3Zl0C+YzA9EoXDIfR5KGGmkw7UuGjwl4PkY1x7e98mCl owlKLuh3g7Sn9NXegosGsVlzdBRiWhd9XS8xr+1TPoae20/wjC4lRuzS2EdXTitW NVd7001FcEBwItlXrlZKDQPAzamsZrPJmrWKIxv6VY9yldWVeT6p5CdKZ9UjceWq UKTb5wu8Zrp0WWs62XyfNdTEtHDIg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgeefgddufecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecukfhppeejuddrvdduvddrudehtddrvddtvdenucfrrghrrghmpehmrghilhhfrhho mheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvg hrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 3BACC380083; Tue, 9 Jul 2019 16:25:06 -0400 (EDT) Subject: Re: execute_values To: "Weatherby,Gerard" , "pgsql-general@lists.postgresql.org" References: From: Adrian Klaver Message-ID: <83543627-3dc3-0a55-e23b-4f6dba55660f@aklaver.com> Date: Tue, 9 Jul 2019 13:25:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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