From 1535c86099b255d013ebd4a62ea320c72525090f Mon Sep 17 00:00:00 2001 From: "Bob \"Wombat\" Hogg" Date: Fri, 24 Nov 2023 11:46:59 -0500 Subject: [PATCH] docs: Show how to use named databases (#932) --- docs/index.rst | 12 ++++++++++++ google/cloud/ndb/__init__.py | 3 --- google/cloud/ndb/client.py | 2 +- tests/unit/test__datastore_api.py | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index ff5ec5fc..1e876df0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -74,6 +74,18 @@ APIs and Services". From there, look for "Databases" in the Category filter. Make sure that both "Cloud Datastore API" and "Google Cloud Firestore API" are enabled. +Accessing a specific project, database, or namespace +==================================================== + +A client can be bound to a chosen Google Cloud project, database, and/or namespace +by passing one or more of these options to the client constructor:: + + client = ndb.Client( + project="your-project-id", + database="your-database-id", + namespace="your-namespace" + ) + Defining Entities, Keys, and Properties ======================================= diff --git a/google/cloud/ndb/__init__.py b/google/cloud/ndb/__init__.py index 871f0cf1..a0c59fc3 100644 --- a/google/cloud/ndb/__init__.py +++ b/google/cloud/ndb/__init__.py @@ -21,9 +21,6 @@ .. autodata:: __all__ """ -from pkg_resources import get_distribution - -__version__ = get_distribution("google-cloud-ndb").version from google.cloud.ndb.client import Client from google.cloud.ndb.context import AutoBatcher diff --git a/google/cloud/ndb/client.py b/google/cloud/ndb/client.py index 767b2199..6cef7d4f 100644 --- a/google/cloud/ndb/client.py +++ b/google/cloud/ndb/client.py @@ -29,7 +29,7 @@ grpc as datastore_grpc, ) -from google.cloud.ndb import __version__ +from google.cloud.ndb.version import __version__ from google.cloud.ndb import context as context_module from google.cloud.ndb import key as key_module diff --git a/tests/unit/test__datastore_api.py b/tests/unit/test__datastore_api.py index 783134b4..219a1e41 100644 --- a/tests/unit/test__datastore_api.py +++ b/tests/unit/test__datastore_api.py @@ -32,7 +32,7 @@ from google.cloud.ndb import model from google.cloud.ndb import _options from google.cloud.ndb import tasklets -from google.cloud.ndb import __version__ +from google.cloud.ndb.version import __version__ from . import utils