From 6b5233e4290cdd3916d27b00d36da196a6b3cbb4 Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Sat, 23 Sep 2017 06:53:34 -0700 Subject: [PATCH] Improve the session pool documentation. --- docs/spanner/database-usage.rst | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/spanner/database-usage.rst b/docs/spanner/database-usage.rst index 529010c8443f..cbbdfbd7d1bf 100644 --- a/docs/spanner/database-usage.rst +++ b/docs/spanner/database-usage.rst @@ -220,12 +220,15 @@ constructor: .. code-block:: python - from google.cloud.spanner import Client - from google.cloud.spanner import FixedSizePool - client = Client() - instance = client.instance(INSTANCE_NAME) - pool = FixedSizePool(size=10, default_timeout=5) - database = instanc.database(DATABASE_NAME, pool=pool) + from google.cloud import spanner + + # Instantiate the Spanner client, and get the appropriate instance. + client = spanner.Client() + instance = client.instance(INSTANCE_NAME) + + # Create a database with a pool of a fixed size. + pool = spanner.FixedSizePool(size=10, default_timeout=5) + database = instance.database(DATABASE_NAME, pool=pool) Note that creating a database with a pool may presume that its database already exists, as it may need to pre-create sessions (rather than creating