adewes / blitzdb

Blitz is a document-oriented database for Python that is backend-agnostic. It comes with a flat-file database for JSON documents and provides MongoDB-like querying capabilities.
http://blitzdb.readthedocs.org
MIT License
330 stars 37 forks source link

Add unique indices #40

Closed cmutel closed 9 years ago

cmutel commented 10 years ago

Grüezi Andreas-

Thanks for making Blitz, it is basically perfect for my use case (also scientific computing and data management).

More of a request for comment than an issue, actually.

I have started work on a unique indices branch. I guess this is not really different than the default behavior, as index hash values are stored in a dictionary in any case, but it would be nice to get an error if a duplicate value was inserted (although this would only happen when committed, not when the offending object was saved). But I am not sure how to handle multi-value indices, or what would make sense here. From looking at add_key, you add an index value for each field, and for the list/tuple of values, if supplied. Do you have any thoughts on what would make the most sense here? Maybe unique indices only make sense on an index with a single field?

adewes commented 9 years ago

Looks like a great feature @cmutel , just let me know if you want to discuss anything or have some code to review, will be glad to help you wherever I can!

cmutel commented 9 years ago

Closing issue - see pull request #45.