-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to insert multiple entries in one method call #8
Comments
Sounds reasonable! Maybe, instead of overloading |
Part of me thinks that The secret sauce in the pymongo insert is:
So we could check if the argument is a dict, and if it is we wrap it in a list, then internally call Even if you exposed OTOH, if you think overloading |
I think in the end that's a philosophical question. I'm not comfortable with
I wouldn't even try ensure that. The user may pass a generator or even some custom class implementing the contianer protocol. If the user passes something else, |
Fair enough. I agree that neither approach is "right" and I don't feel that strongly about it either way. TinyDB is a really nice package and the most important thing is that it's consistent with its own philosophy :) |
BTW: I've just released v1.4.0 (GitHub and PyPI) containing the new |
It would be very useful if multiple entries could be inserted into a tinydb in one method call, by passing an array of dicts.
My preference would be to overload
insert()
so you could write:One common use case would be serialising multiple JSON records consumed via RESTful APIs
The text was updated successfully, but these errors were encountered: