Re: ON CONFLICT DO UPDATE

2018-05-10 Thread Adrian Klaver
On 05/09/2018 09:50 PM, tango ward wrote: Ccing list. Hi, this is the my ON CONFLICT CODE ON CONFLICT (school_system_id,   student_id,   campus_name   ) DO UPDATE   

Re: ON CONFLICT DO UPDATE

2018-05-10 Thread tango ward
Yes, that's what I figured out eventually. I thought, only the columns that I declared inside the ON CONFLICT() parenthesis can be called in SET. My bad. On Thu, May 10, 2018 at 5:57 PM, Alban Hertroys wrote: > > > On 10 May 2018, at 7:13, tango ward wrote: > > > ON CO

Re: ON CONFLICT DO UPDATE

2018-05-10 Thread Alban Hertroys
> On 10 May 2018, at 7:13, tango ward wrote: > ON CONFLICT (school_system_id, > student_id, > campus_name > ) DO UPDATE > SET s

Re: ON CONFLICT DO UPDATE

2018-05-09 Thread tango ward
Okay, I think I manage to solve it by adding balance = excluded.balance inside the parenthesis of ON CONFLICT clause. On Thu, May 10, 2018 at 1:13 PM, tango ward wrote: > Sorry Sir Adrian, updating the code. > > for row in cur_tdc: > print row['studentnumber'], row['firstname'], row['las

Re: ON CONFLICT DO UPDATE

2018-05-09 Thread tango ward
Sorry Sir Adrian, updating the code. for row in cur_tdc: print row['studentnumber'], row['firstname'], row['lastname'], row['currentbalance'] cur_phil.execute(""" INSERT INTO recipients_studentbalance( created, modifi

Re: ON CONFLICT DO UPDATE

2018-05-09 Thread tango ward
Sorry, I modified the school_system_id in CONFLICT CLAUSE. On Thu, May 10, 2018 at 12:07 PM, Adrian Klaver wrote: > On 05/09/2018 07:04 PM, tango ward wrote: > >> >> Hi, >> >> Sorry for asking question again. >> >> I would like to know if there's a workaround for this. I need to insert >> Studen

Re: ON CONFLICT DO UPDATE

2018-05-09 Thread Adrian Klaver
On 05/09/2018 07:04 PM, tango ward wrote: Hi, Sorry for asking question again. I would like to know if there's a workaround for this. I need to insert Student Balance data into a table. The source data have duplicate values for student_id, school_id and campus_name. My StudentBalance model i