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

[ENH]: add API to list all databases for tenant #3432

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jan 8, 2025

Description of changes

Adds a method to the admin client to list all databases for a tenant. Has limit/offset parameters similar to how listing collections works.

The implementation for distributed Chroma is in a separate PR, next in this stack: #3440.

See https://github.com/chroma-core/hosted-chroma/issues/900 for main tracking issue.

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?

Updated.

Copy link

github-actions bot commented Jan 8, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@codetheweb codetheweb marked this pull request as ready for review January 8, 2025 01:15
@codetheweb codetheweb requested a review from atroyn January 8, 2025 01:15
Copy link
Contributor

@atroyn atroyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want the tests to cover the case where we have multiple tenants, since we want to be sure that we are correctly listing only the databases in a particular tenant.

Otherwise, implementation LGTM.

@codetheweb codetheweb requested a review from atroyn January 8, 2025 17:59
for i in range(10):
admin_client.create_database(f"test_list_databases_is_tenant_scoped_{i}")

databases = admin_client.list_databases(None, None, "new_tenant")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably put some databases in the other tenant to list as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a fixture we reuse in each test.

Copy link
Contributor

@atroyn atroyn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the tests could be still further extended. I'm thinking about protecting us against the scenario where one day someone lists databases and because of a bug we wrote gets other people's databases as well.

Copy link
Contributor Author

codetheweb commented Jan 9, 2025

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.

2 participants