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 1m3Qo9-0000yQ-6x for psycopg@arkaria.postgresql.org; Tue, 13 Jul 2021 22:23:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3Qo7-0001vQ-Uf for psycopg@arkaria.postgresql.org; Tue, 13 Jul 2021 22:23:15 +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 1m3Qo7-0001vH-P3 for psycopg@lists.postgresql.org; Tue, 13 Jul 2021 22:23:15 +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 1m3Qo5-0006dU-Ko for psycopg@postgresql.org; Tue, 13 Jul 2021 22:23:14 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id BD7C85C0110; Tue, 13 Jul 2021 18:23:12 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 13 Jul 2021 18:23:12 -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=l mZrKAi6leouIF0nPqANgoftftpf6obpfAW11W5x+LY=; b=KtJ/12AM2FYDKo0IR DiOwI0NIOGqvP8Q7BsaxDC8dWLqjTPWmT/lesKl4zFTqkNk6QXgIlmhpGlvY/KHR yDdjyxWIUfKOG2qWzlYgn/AeFifUxORHdPoHTYZRlU+EdmDTmuzKKywx9P8kp2Mx +3+JvN9TYI4KwpAMOfGgpNuKnlhRiQSsC7Z9xka+BQwiiJ6yEsHEiTinSBfDUFCw eorK9RI002gKCHdqpLvqMttRVpb57gbtXxeqYWV30uKM+2LMBP4AQukWDbJfVvVr IgFKSrqw0enOZigZv4AAJIXnVta3+pA3CfL58A8Sp3ZAa9alOkru/yfa1arg7876 jLW7w== 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=lmZrKAi6leouIF0nPqANgoftftpf6obpfAW11W5x+ LY=; b=f47hGr9QxxsRxm2KbdVcGoJKaK0lM0ZjMoocIPfZXo0XwOU/uPyveY+No Lemy4k4qlDG3VPLxMct8lltFUV3P9vZoZurtiR3yefajZL4nOIFZAf7qezHeFfnR X+7jH+5RE46ID6iMv/r2bVebGGOuUvjKshVj+RABoTrIsYpEAE5l5GIGso5oDGqW 3t8nK6WMZf4iQ8EXe8hDyC25uOuJuDJ8R6fBTIdsm1+6H/GKyvRa1FlEdyXueQ1M cskMx2nWS/9RH6mIec2kzuCaQSJQrZPvoJqltHPknX5ymjxU+Ue0UKth0R3feVZ4 GXbo9H8xXtWyfhEKy6bbDn9orEp7g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudejgddtgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuvfhfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecuggftrfgrthhtvghrnhepieehtdelgeduueetledtjefgleffgfekhfeitdefheej hedvffdvveeutdekgfdvnecuffhomhgrihhnpehpshihtghophhgrdhorhhgpdhsthgrtg hkohhvvghrfhhlohifrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghm pehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 13 Jul 2021 18:23:11 -0400 (EDT) Subject: Re: New user questions To: Rich Shepard , psycopg@postgresql.org References: <36d964b4-e04b-5fdf-9b21-d3bf80a3505d@aklaver.com> From: Adrian Klaver Message-ID: <9b477722-71af-abbb-8db7-1390a9906b07@aklaver.com> Date: Tue, 13 Jul 2021 15:23:11 -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: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/13/21 3:02 PM, Rich Shepard wrote: > On Tue, 13 Jul 2021, Adrian Klaver wrote: > >> 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. > > Adrian, > > That makes sense: the statements are treated as comments. I hadn't thought > of them that way. To be clear triple quoting is just one of the ways you can quote things in Python. When it is done in a specific location in a function, class or class method then it becomes a docstring(comment). It does not turn other things into a comment. >> There are several ways to read the above. >> Send some examples of what you want to do. > > Here's a template: > > update contacts > set where > ; > > The contacts table has these attributes: > person_nbr   | integer > act_date     | date > act_type     | character varying(12) > notes        | text > next_contact | date > > Could be a changed next_contact date, or notes, or both. > > Other tables need updating; for example, a new job title for a person or a > new web site for a company. Then you want to take a look at this: https://www.psycopg.org/docs/sql.html For an UPDATE example see my answer to this Stack Overflow question: https://stackoverflow.com/questions/68321746/how-to-create-a-dynamic-update-query-in-sql-using-python/68323019#comment120800261_68323019 > > Thanks, > > Rich > > -- Adrian Klaver adrian.klaver@aklaver.com