Re: New user questions - Mailing list psycopg

From Adrian Klaver
Subject Re: New user questions
Date
Msg-id 36d964b4-e04b-5fdf-9b21-d3bf80a3505d@aklaver.com
Whole thread Raw
In response to New user questions  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: New user questions  (Rich Shepard <rshepard@appl-ecosys.com>)
List psycopg
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



psycopg by date:

Previous
From: Rich Shepard
Date:
Subject: New user questions
Next
From: Rich Shepard
Date:
Subject: Re: New user questions