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 method to delete database (single-node) #3457

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jan 9, 2025

Description of changes

Adds a method to delete a database.

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?

Yes.

Copy link

github-actions bot commented Jan 9, 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)

Copy link
Contributor Author

codetheweb commented Jan 9, 2025

@codetheweb codetheweb changed the title [ENH]: add method to delete database [ENH]: add method to delete database (single-node) Jan 9, 2025
@codetheweb codetheweb marked this pull request as ready for review January 9, 2025 19:18
@codetheweb codetheweb requested a review from atroyn January 9, 2025 19:18
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 can make the tests a little more robust.

What happens if a user has a handle on a Collection, and then delete_database gets called underneath? Maybe we need a friendly error to let them know what happened.

chromadb/test/api/test_delete_database.py Show resolved Hide resolved
client = client_factories.create_client(database="second")
collection = client.create_collection("test")

admin_client.delete_database("first")
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 make sure this works when first has a collection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, not quite clear: do you mean testing that deleting a database works when the database has a collection? that's already tested above

@codetheweb
Copy link
Contributor Author

What happens if a user has a handle on a Collection, and then delete_database gets called underneath? Maybe we need a friendly error to let them know what happened.

InvalidCollectionException will be thrown. Updated the test to assert this.

@codetheweb codetheweb requested a review from atroyn January 9, 2025 21:10
@codetheweb codetheweb force-pushed the feat-list-databases-api branch from f2fc604 to b9bdfe2 Compare January 9, 2025 21:55
@codetheweb codetheweb force-pushed the feat-delete-database-single-node branch from 654c768 to 8e3c1ca Compare January 9, 2025 21:55
@codetheweb codetheweb force-pushed the feat-list-databases-api branch from b9bdfe2 to 8b3a2e8 Compare January 9, 2025 23:10
@codetheweb codetheweb force-pushed the feat-delete-database-single-node branch from 8e3c1ca to 9c8302f Compare January 9, 2025 23:10
@codetheweb codetheweb changed the base branch from feat-list-databases-api to graphite-base/3457 January 10, 2025 00:38
@codetheweb codetheweb force-pushed the feat-delete-database-single-node branch from 9c8302f to adc995d Compare January 10, 2025 00:39
@codetheweb codetheweb changed the base branch from graphite-base/3457 to main January 10, 2025 00:40
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