Skip to content

Commit 8502745

Browse files
committed
fix(spanner): remove invalid database arg from pool constructor
FixedSizePool and other Spanner session pools do not accept a database argument in their constructor. The pool is created standalone and then passed to the Database constructor via the pool= parameter.
1 parent cb64665 commit 8502745

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

sqlspec/adapters/spanner/config.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,6 @@ def _create_pool(self) -> AbstractSessionPool:
151151
msg = "instance_id and database_id are required."
152152
raise ImproperConfigurationError(msg)
153153

154-
client = cast("Any", self._get_client())
155-
instance = client.instance(instance_id)
156-
database = instance.database(database_id, pool=None)
157-
158154
pool_type = cast("type[AbstractSessionPool]", self.pool_config.get("pool_type", FixedSizePool))
159155

160156
pool_kwargs: dict[str, Any] = {}
@@ -172,7 +168,7 @@ def _create_pool(self) -> AbstractSessionPool:
172168
pool_kwargs["size"] = self.pool_config["max_sessions"]
173169

174170
pool_factory = cast("Callable[..., AbstractSessionPool]", pool_type)
175-
return pool_factory(database, **pool_kwargs)
171+
return pool_factory(**pool_kwargs)
176172

177173
def _close_pool(self) -> None:
178174
if self.pool_instance and hasattr(self.pool_instance, "close"):

0 commit comments

Comments
 (0)