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

For insertions and queries, use a unified interface #2066

Open
jieguangzhou opened this issue May 17, 2024 · 5 comments
Open

For insertions and queries, use a unified interface #2066

jieguangzhou opened this issue May 17, 2024 · 5 comments

Comments

@jieguangzhou
Copy link
Collaborator

jieguangzhou commented May 17, 2024

For MongoDB and Ibis
Currently:

  • MongoDB uses insert_many for data insertion and find for queries.
  • Ibis uses insert for data insertion and select for queries.

For these very frequent interfaces, we can provide a unified method:

db["table_or_collection_name"].insert(datas)
df["table_or_collection_name"].query(a=1, b=2)
  • insert_one
  • query_one
  • filter
  • limit
  • output_fields

By standardizing these common operations, similar to the most frequently used ones in superduperdb, everything will become simpler to use. For complex operations, the original logic can still be used.

As for the names, we can discuss and define query/select/find later.

@blythed
Copy link
Collaborator

blythed commented May 17, 2024

That's nice, but I feel that it might make messaging difficult. Until now our USP has been "use your frameworks"
exactly as you are used to. Now we add a new uniform abstraction. Although, personally this is a feature I would enjoy.

Later when we index things which aren't directly websites, then we can do things like:

db = superduper("http://bbc.com")

db["europe"].query(tag='a')      # points to http://bbc.com/europe, selects link tags

@jieguangzhou
Copy link
Collaborator Author

jieguangzhou commented May 17, 2024

This is not conflicting, they can also use the original method, WDYT?

If we don’t want to expose it to users, we can choose not to expose this method.

However, this method is of great help to our UT and integration testing. We can now test two types of databases with one set of code.

For example, These two test cases have a lot of redundant codes

image

@blythed
Copy link
Collaborator

blythed commented May 17, 2024

Yes, I see your point, could be potentially very useful, yes.

@fnikolai
Copy link
Collaborator

fnikolai commented May 17, 2024

@jieguangzhou

Since query is an abused term that may also include actions such as Create() or Delete(), I 'd prefer select().

@jieguangzhou
Copy link
Collaborator Author

@jieguangzhou

Since query is an abused term that may also include actions such as Create() or Delete(), I 'd prefer select().

Sure, used select now

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

No branches or pull requests

3 participants