Re: Inserting variable into

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: hagen(at)datasundae(dot)com, psycopg(at)lists(dot)postgresql(dot)org, psycopg(at)postgresql(dot)org
Subject: Re: Inserting variable into
Date: 2020-12-07 22:03:42
Message-ID: 5c55fb91-0b03-2077-fce7-38f2dcc0d402@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On 12/7/20 2:02 PM, hagen(at)datasundae(dot)com 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
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message hagen 2020-12-07 22:26:26 RE: Inserting variable into
Previous Message hagen 2020-12-07 22:02:03 Inserting variable into