Using Singleton Pattern with Weaviate Client in Python


I’m working on using the Weaviate client in Python and wondering if employing the Singleton Pattern is a good idea. Typically, we use the Singleton Pattern for connecting to databases. Any thoughts on whether this pattern is suitable for Weaviate client in Python?

Thanks for your input.



AFAIK the client is lazy, so until you actually call a query, it will have a little overhead on initiating it. So both singleton and constantly initiating should work fine.

Also, it’s probably interesting to check out our new python client, currecntly in beta, as it will bring a lot of great features along with it:

Let me know if that helps :slight_smile: