edgedb-python icon indicating copy to clipboard operation
edgedb-python copied to clipboard

Make `create_client()` return a singleton client

Open 1st1 opened this issue 7 months ago • 1 comments

We've discussed this multiple times, time to do it.

create_client() and create_async_client() should create a client once upon the first call (one sync singleton and one async singleton respectively) and follow on calls should just return that first thing.

  • Add detached=False argument to force creating a new client when flipped to True
  • Obviously singletons should be partitioned by connection arguments
  • Use weakref.WeakValueDictionaty[ConnectionSpec, Client]

1st1 avatar May 31 '25 15:05 1st1

@elvis and @msullivan will discuss this and update this issue

1st1 avatar Jun 16 '25 19:06 1st1