[sqlalchemy] Re: trouble when second time insert value

2017-05-21 Thread R0R0N0A
solved it by checking before inserting use session.query().filter().count() now everything runs ok . many thanks On Sunday, May 21, 2017 at 11:13:37 PM UTC+8, bb1898 wrote: > > Am 21.05.2017 um 13:45 schrieb R0R0N0A: > > it's true that I insert the same record every time I run the code > >

[sqlalchemy] Re: trouble when second time insert value

2017-05-21 Thread Sibylle Koczian
Am 21.05.2017 um 13:45 schrieb R0R0N0A: it's true that I insert the same record every time I run the code But it's unique , right ? it shouldn't insert to the table right ? Quite right - and obviously it didn't. The database system must tell you that it couldn't insert the record. And of

[sqlalchemy] Re: trouble when second time insert value

2017-05-21 Thread R0R0N0A
I followed this blog ```https://www.dataquest.io/blog/apartment-finding-slackbot/``` ` How I built a Slack bot to help me find an apartment in San Francisco ` it says `that set the parameter as unique , in case of duplicates` and I

[sqlalchemy] Re: trouble when second time insert value

2017-05-21 Thread R0R0N0A
it's true that I insert the same record every time I run the code But it's unique , right ? it shouldn't insert to the table right ? My purpose is loop the code and see if any new record updated , if so , insert into the table . any where I did wrong ? thanks On Sunday, May 21, 2017 at

[sqlalchemy] Re: trouble when second time insert value

2017-05-21 Thread Sibylle Koczian
Am 21.05.2017 um 12:28 schrieb R0R0N0A: I have a table and some keys inside it have two unique key when i first run the code it runs okay but when I sencond time run it it says a unique key constrains here's the matter that I need to loop the code to query some new updates and insert to