Skip to content

Commit

Permalink
docs: Show how to use named databases (#932)
Browse files Browse the repository at this point in the history
  • Loading branch information
rwhogg authored and parthea committed Nov 24, 2023
1 parent 2e6897d commit 1535c86
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
12 changes: 12 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=======================================

Expand Down
3 changes: 0 additions & 3 deletions google/cloud/ndb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/ndb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test__datastore_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 1535c86

Please sign in to comment.