Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m3QJs-0008CF-5s for psycopg@arkaria.postgresql.org; Tue, 13 Jul 2021 21:52:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3QJq-00065u-HA for psycopg@arkaria.postgresql.org; Tue, 13 Jul 2021 21:51:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m3QJo-00065m-TP for psycopg@lists.postgresql.org; Tue, 13 Jul 2021 21:51:58 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m3QJh-0006PU-K9 for psycopg@postgresql.org; Tue, 13 Jul 2021 21:51:55 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 60C5D5C0041; Tue, 13 Jul 2021 17:51:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 13 Jul 2021 17:51:48 -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=b 7JIh6Nr3gWi6jwxMEoIq4u3u82OfoGxNGAdqo8oxso=; b=sbstIvMmnwZKFKVGs 8BR8g8YzKnr6ursEupldvFz1TMutKibVS4cocO50lUs9A5WDCbfHeRFkQ8/vgtPC VZ7V7MUxWqr3ZUiqVtzHzKdP4JHn6IvncVdDVIsElRJ3EC5L4tAzhGdk3GT0wqjv U5YPM9F7Qmq/Opr3izQrL1CdkwzA8ckHQaN52KAJgbjDkZYbeZh3JAlVI/I5VIGo xf1d1VHT6uIpF9jCbHw16e3DaavgW12y/zVdaGdpcUURQ390v0aYl3XGq6MKpsCr zFslFlvKXZaaroh+5NBCMmXweT5UuLA5lQgDkaNX7GuMGKDOBFV4ZEw9cClhyxkJ nadQg== 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=b7JIh6Nr3gWi6jwxMEoIq4u3u82OfoGxNGAdqo8ox so=; b=a3LcY/SRoN5z7FJsxGz8EyZ8Ehx7KYruXPfbHF3Q9F0va/8a1T0UetfQD kGthjxB630XPiuW+hBDwsBolCmAk5H/fV27I0grH7Ou/V45W5fzICROOhPQK0MCp PqYOn/OeEB5x1+utLmiabFhR1VYFP3rx6unw26rD1GfMxNOEfsxJAZHGTNTpeSQq CYWzwP/aqGim5hFGZ3rL6fH77zJiz2S16V5pYqyDpVgxFr0dBExnF0BXBwVHIu+k wMjzFawp+NTXo0px6YO9FKIC+7lPQ+CQ14HPdxjtrqtvkpLAdwc672n7uMAoFEbT 3VrOPzZPl+Wjekbz+IjjUI540Aj8A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeigddvvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepteejvdetffejuedvleeifeefheeutdfhgfdvhffhhfek vdduveegvdejudefgfevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 13 Jul 2021 17:51:47 -0400 (EDT) Subject: Re: New user questions To: Rich Shepard , psycopg@postgresql.org References: From: Adrian Klaver Message-ID: <36d964b4-e04b-5fdf-9b21-d3bf80a3505d@aklaver.com> Date: Tue, 13 Jul 2021 14:51:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/13/21 1:09 PM, Rich Shepard wrote: > I'm starting to learn psycopg2 and have read the basic module usage doc. > Two > questions on syntax: > > 1) I've seen a number of psycopg2 cursor execute examples where the select > or insert statement is enclosed in a pydoc pair of three double quotes. > Most > examples in the basic module usage examples have a single pair of double > quotes enclosing the statement; the named variable examples are exceptions. > Is there a general rule when to use triple double quotes and when to use > single double quotes? Triple quoting is used when the statement extends across more then one line. Pair of double quotes is used for single line statement, especially when there are single quoted values in the statement. > > 2) How do I write a cursor execute UPDATE statement where the columns and > values to be updated can be single or multiple and the values passed into > the method from the tkinter widgets? Are there examples from which I can > learn? There are several ways to read the above. Send some examples of what you want to do. > > Regards, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com