public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: [email protected]
To: [email protected]
To: [email protected]
Subject: Re: Inserting variable into
Date: Mon, 7 Dec 2020 14:03:42 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On 12/7/20 2:02 PM, [email protected] wrote:
> Hello,
> 
> I'd like to use a variable for 'Big Company' (e.g. account) or where = statements generally in my cur.execute statements:
> 
> cur.execute("SELECT SUM(revusd) FROM sfdc where saccount = 'Big Company' AND stage LIKE 'Commit%';")
> commitd1 = cur.fetchone()
> conn.commit()
> 
> but I don't know the proper syntax with the cur.execute statement to use a variable.

https://www.psycopg.org/docs/usage.html#passing-parameters-to-sql-queries

> 
> I imagine others do  - thanks!
> 
> Best,
> 
> Hagen
> 
> 
> 


-- 
Adrian Klaver
[email protected]





view thread (11+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Inserting variable into
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox