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 database
I dont know why except the first time . why other time I run it , it got 
error 

many thanks !

```
__tablename__ = 'listings'

    id = Column(Integer,primary_key=True,autoincrement=True)
    link = Column(String,unique=True)
    title = Column(String)
    img = Column(String,unique=True)
    name = Column(String)
```

error code : 
```
UNIQUE constraint failed: listings.img [SQL: 'INSERT INTO listings (link, 
title, img, name) VALUES (?, ?, ?, ?)']
```

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to