Re: Insert data if it is not existing
| От | Adrian Klaver |
|---|---|
| Тема | Re: Insert data if it is not existing |
| Дата | |
| Msg-id | 6f46b2b5-c69a-fa85-a66b-8ff318a82aa1@aklaver.com обсуждение исходный текст |
| Ответ на | Re: Insert data if it is not existing (tango ward <tangoward15@gmail.com>) |
| Ответы |
Re: Insert data if it is not existing
|
| Список | pgsql-general |
On 05/23/2018 06:03 PM, tango ward wrote:
>
> Updated my code to this:
>
> curr.pgsql.execute('''
> INSERT INTO my_table(name, age)
> SELECT %s, %s
> WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= name)
> ''', ('Scott', 23))
>
> If I remove SELECT statement, I will get an error message: error :
> psycopg2.ProgrammingError: syntax error at or near "WHERE"
> LINE 12: WHERE NOT EXISTS
>
> Trying to coordinate with Lead Dev about adding Index On The Fly
I tried to figure how to make this work and could not, so I led you down
a false path.
>
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
В списке pgsql-general по дате отправления: