Re: How do I use parameterized queries with LIKE?

From: "P(dot) Christeas" <xrg(at)linux(dot)gr>
To: psycopg(at)postgresql(dot)org
Subject: Re: How do I use parameterized queries with LIKE?
Date: 2012-05-28 22:44:26
Message-ID: 201205290144.27622.xrg@linux.gr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Tuesday 29 May 2012, W. Matthew Wilson wrote:
> This works just fine:
>
> cursor.execute("""select email_address from customer where
> email_address like '%matt%'""")

You'd probably need to escape the percent signs like:
cursor.execute("""select email_address from customer where email_address like
'%%matt%%'""")

--
Say NO to spam and viruses. Stop using Microsoft Windows!

In response to

Browse psycopg by date

  From Date Subject
Next Message W. Matthew Wilson 2012-05-29 00:30:31 Re: How do I use parameterized queries with LIKE?
Previous Message Daniele Varrazzo 2012-05-28 22:42:55 Re: How do I use parameterized queries with LIKE?