pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
232 stars 70 forks source link

multi-column primary key #13

Closed nypgand1 closed 8 years ago

nypgand1 commented 9 years ago

In the docs of SQLAlchemy, it says:

Multiple columns may be assigned the primary_key=True flag which denotes a multi-column primary key, known as a composite primary key.

But in eve-sqlalchemy and cerberus, we validate the unique constraint in the scope of single column.

Any suggestions on this issue?

nypgand1 commented 9 years ago

@nicolaiarocci Hi, any suggestions on this issue?

goneri commented 8 years ago

I think we can also just catch the DB constraint failure and for free we will get better performance. So far Eve-SQLAlchemy just generate suspicious 500 err.

mandarvaze commented 8 years ago

@nypgand1 The issue is marked as closed. Did it solve your problem ? I'm using Eve-SQLAlchemy 0.4.1, and still seeing this issue (i.e. unique constrain checked on single column rather than on a composite key)

@nicolaiarocci help ?

nypgand1 commented 8 years ago

@mandarvaze Sorry. I'm not quite sure whether it is solved or not, because I don't use it now.

nicolaiarocci commented 8 years ago

Hi guys, I don't work on the sql-alchemy extension and don't use it in production so I'm afraid I can offer no help here.

nicolaiarocci commented 8 years ago

PS in Eve, unique rule is a feature of the Mongo validator.

bthorben commented 8 years ago

Workaround: You can basically just remove the unique constraint. Eve will not check and if you actually enter something into the db that violates your constraint you will get an IntegrityError

bthorben commented 8 years ago

Could we please reopen this issue? It still exists and this is the place with the most information about it. The mentioned fix seems to have references the wrong issue.