Skip to content
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

Get Multiple Documents through get method of Table #504

Merged
merged 5 commits into from
May 20, 2023

Conversation

keenborder786
Copy link
Contributor

The feature augmentation in the table class is as per the requirement of #486. The user can now query multiple documents by specifying multiple doc_ids in form of a list in the get method of the Table class:

from tinydb import TinyDB, Query
db = TinyDB('/path/to/db.json')
db.insert({'int': 1, 'char': 'a'})
db.insert({'int': 1, 'char': 'b'})
db.get(doc_ids = [1,2]) # will return both the documents in form of list

@keenborder786 keenborder786 changed the title Get Multiple Doc id in get #486 Get Multiple Documents through get method of Table Jan 23, 2023
@keenborder786
Copy link
Contributor Author

Any updates?

@msiemens
Copy link
Owner

msiemens commented May 6, 2023

Hey @keenborder786, sorry for not answering for so long! I was quite busy with work lately.

All in all, this looks quite good, my only suggestion would be to not reuse the doc_id parameter but instead use another doc_ids parameter just like you mentioned in your PR description. This way using doc_id will not break when users use a document ID class other than int 🙂 Could you adapt your code in this manner?

@keenborder786
Copy link
Contributor Author

sure. I will have a look.

@keenborder786
Copy link
Contributor Author

@msiemens can you please see now?

@msiemens msiemens merged commit 6f03ec6 into msiemens:master May 20, 2023
0 of 16 checks passed
@msiemens
Copy link
Owner

Thanks for your contribution @keenborder786!

@msiemens
Copy link
Owner

I'll try to prepare a release of TinyDB with this feature sometime in the next two weeks

@msiemens
Copy link
Owner

Hey! I've now release TinyDB 4.8.0 that includes this feature 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants