Skip to content

Commit 4fcd8c4

Browse files
committed
chore: regenerate with librarian (all except skipped packages)
1 parent de27953 commit 4fcd8c4

File tree

64 files changed

+412
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+412
-50
lines changed

packages/bigquery-magics/.repo-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
"name": "bigquery-magics",
99
"name_pretty": "Google BigQuery connector for Jupyter and IPython",
1010
"product_documentation": "https://cloud.google.com/bigquery",
11-
"release_level": "stable",
11+
"release_level": "preview",
1212
"repo": "googleapis/google-cloud-python"
1313
}

packages/db-dtypes/.repo-metadata.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"api_description": "Pandas extension data types for data from SQL systems such as BigQuery.",
32
"api_id": "bigquery.googleapis.com",
43
"client_documentation": "https://googleapis.dev/python/db-dtypes/latest/index.html",
54
"distribution_name": "db-dtypes",
Lines changed: 288 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,288 @@
1-
.. include:: ../README.rst
1+
Cloud Spanner support for Django
2+
================================
3+
4+
|GA| |pypi| |versions|
5+
6+
`Cloud Spanner`_ is the world's first fully managed relational database service
7+
to offer both strong consistency and horizontal scalability for
8+
mission-critical online transaction processing (OLTP) applications. With Cloud
9+
Spanner you enjoy all the traditional benefits of a relational database; but
10+
unlike any other relational database service, Cloud Spanner scales horizontally
11+
to hundreds or thousands of servers to handle the biggest transactional
12+
workloads.
13+
14+
15+
- `Client Library Documentation`_
16+
- `Product Documentation`_
17+
18+
.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
19+
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
20+
.. |pypi| image:: https://img.shields.io/pypi/v/django-google-spanner.svg
21+
:target: https://pypi.org/project/django-google-spanner/
22+
.. |versions| image:: https://img.shields.io/pypi/pyversions/django-google-spanner.svg
23+
:target: https://pypi.org/project/django-google-spanner/
24+
.. _Cloud Spanner: https://cloud.google.com/spanner/
25+
.. _Client Library Documentation: https://googleapis.dev/python/django-google-spanner/latest/index.html
26+
.. _Product Documentation: https://cloud.google.com/spanner/docs
27+
28+
Quick Start
29+
-----------
30+
31+
In order to use this library, you first need to go through the following steps:
32+
33+
1. `Select or create a Cloud Platform project.`_
34+
2. `Enable billing for your project.`_
35+
3. `Enable the Google Cloud Spanner API.`_
36+
4. `Setup Authentication.`_
37+
38+
.. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
39+
.. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
40+
.. _Enable the Google Cloud Spanner API.: https://cloud.google.com/spanner
41+
.. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
42+
43+
This package provides a `3rd-party database backend
44+
<https://docs.djangoproject.com/en/4.2/ref/databases/#using-a-3rd-party-database-backend>`__
45+
for using `Cloud Spanner <https://cloud.google.com/spanner>`__ with the `Django
46+
ORM <https://docs.djangoproject.com/en/4.2/topics/db/>`__. It uses the `Cloud
47+
Spanner Python client library <https://github.com/googleapis/python-spanner>`__
48+
under the hood.
49+
50+
Installation
51+
------------
52+
53+
Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
54+
create isolated Python and Django environments. The basic problem it addresses is one of
55+
dependencies and versions, and indirectly permissions.
56+
57+
With `virtualenv`_, it's possible to install this library without needing system
58+
install permissions, and without clashing with the installed system
59+
dependencies.
60+
61+
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
62+
63+
64+
Supported versions
65+
~~~~~~~~~~~~~~~~~~
66+
67+
The library supports `Django 3.2
68+
<https://docs.djangoproject.com/en/3.2/>`_, and `Django 4.2
69+
<https://docs.djangoproject.com/en/4.2/>`_.
70+
Both versions are long-term support (LTS) releases for the
71+
`Django project<https://www.djangoproject.com/download/#supported-versions>_`.
72+
The minimum required Python version is 3.6.
73+
74+
.. code:: shell
75+
76+
pip3 install django==3.2
77+
78+
79+
Installing the package
80+
~~~~~~~~~~~~~~~~~~~~~~
81+
82+
To install from PyPI:
83+
84+
.. code:: shell
85+
86+
pip3 install django-google-spanner
87+
88+
89+
To install from source:
90+
91+
.. code:: shell
92+
93+
git clone git@github.com:googleapis/google-cloud-python.git
94+
cd python-spanner-django
95+
pip3 install -e .
96+
97+
98+
Creating a Cloud Spanner instance and database
99+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100+
101+
If you don't already have a Cloud Spanner database, or want to start from
102+
scratch for a new Django application, you can `create a new instance
103+
<https://cloud.google.com/spanner/docs/getting-started/python#create_an_instance>`__
104+
and `database
105+
<https://cloud.google.com/spanner/docs/getting-started/python#create_a_database>`__
106+
using the Google Cloud SDK:
107+
108+
.. code:: shell
109+
110+
gcloud spanner instances create $INSTANCE --config=regional-us-central1 --description="New Django Instance" --nodes=1
111+
gcloud spanner databases create $DB --instance $INSTANCE
112+
113+
114+
Configuring ``settings.py``
115+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
116+
117+
This package provides a Django application named ``django_spanner``. To use the
118+
Cloud Spanner database backend, the application needs to installed and
119+
configured:
120+
121+
- Add ``django_spanner`` as the first entry in ``INSTALLED_APPS``:
122+
123+
.. code:: python
124+
125+
INSTALLED_APPS = [
126+
'django_spanner',
127+
...
128+
]
129+
130+
- Edit the ``DATABASES`` setting to point to an existing Cloud Spanner database:
131+
132+
.. code:: python
133+
134+
DATABASES = {
135+
'default': {
136+
'ENGINE': 'django_spanner',
137+
'PROJECT': '$PROJECT',
138+
'INSTANCE': '$INSTANCE',
139+
'NAME': '$DATABASE',
140+
}
141+
}
142+
143+
Configuring primary key generation
144+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
145+
146+
The Spanner Django engine by default uses random int64 values that are generated
147+
by the client as primary key values. This default is applied to all databases that are
148+
configured, including databases that use a different engine than Spanner. You can
149+
disable this behavior with the RANDOM_ID_GENERATION_ENABLED setting:
150+
151+
.. code:: python
152+
153+
DATABASES = {
154+
'default': {
155+
'ENGINE': 'django_spanner',
156+
'PROJECT': '$PROJECT',
157+
'INSTANCE': '$INSTANCE',
158+
'NAME': '$DATABASE',
159+
'RANDOM_ID_GENERATION_ENABLED': false,
160+
}
161+
}
162+
163+
164+
165+
Transaction support in autocommit mode
166+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
167+
168+
Django version 4.2 and higher by default supports transactions in autocommit mode.
169+
A transaction is automatically started if you define an
170+
[atomic block](https://docs.djangoproject.com/en/4.2/topics/db/transactions/#controlling-transactions-explicitly).
171+
172+
Django version 3.2 and earlier did not support transactions in autocommit mode with Spanner.
173+
You can enable transactions in autocommit mode with Spanner with the
174+
`ALLOW_TRANSACTIONS_IN_AUTO_COMMIT` configuration option.
175+
176+
- To enable transactions in autocommit mode in V3.2, set the flag `ALLOW_TRANSACTIONS_IN_AUTO_COMMIT` to True in your settings.py file.
177+
- To disable transactions in autocommit mode in V4.2, set the flag `ALLOW_TRANSACTIONS_IN_AUTO_COMMIT` to False in your settings.py file.
178+
179+
180+
Set credentials and project environment variables
181+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
182+
You'll need to download a service account JSON key file and point to it using an environment variable:
183+
184+
.. code:: shell
185+
186+
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/keyfile.json
187+
export GOOGLE_CLOUD_PROJECT=gcloud_project
188+
189+
190+
Apply the migrations
191+
~~~~~~~~~~~~~~~~~~~~
192+
193+
Please run:
194+
195+
.. code:: shell
196+
197+
$ python3 manage.py migrate
198+
199+
That'll take a while to run. After this you should be able to see the tables and indexes created in your Cloud Spanner console.
200+
201+
202+
Create a Django admin user
203+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
204+
First you’ll need to create a user who can login to the admin site. Run the following command:
205+
206+
.. code:: shell
207+
208+
$ python3 manage.py createsuperuser
209+
210+
which will then produce a prompt which will allow you to create your super user
211+
212+
.. code:: shell
213+
214+
Username: admin
215+
Email address: admin@example.com
216+
Password: **********
217+
Password (again): **********
218+
Superuser created successfully.
219+
220+
221+
Login as admin
222+
~~~~~~~~~~~~~~
223+
Now, run the server
224+
225+
.. code:: shell
226+
227+
python3 manage.py runserver
228+
229+
Then visit http://127.0.0.1:8000/admin/
230+
231+
Create and register your first model
232+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233+
234+
Please follow the guides in https://docs.djangoproject.com/en/4.2/intro/tutorial02/#creating-models
235+
to create and register the model to the Django’s automatically-generated admin site.
236+
237+
How it works
238+
------------
239+
240+
Overall design
241+
~~~~~~~~~~~~~~
242+
243+
.. figure:: https://raw.githubusercontent.com/googleapis/google-cloud-python/main/assets/overview.png
244+
:alt: "Overall Design"
245+
246+
Internals
247+
~~~~~~~~~
248+
249+
.. figure:: https://raw.githubusercontent.com/googleapis/google-cloud-python/main/assets/internals.png
250+
:alt: "Internals"
251+
252+
253+
Executing a query
254+
~~~~~~~~~~~~~~~~~
255+
256+
Here is an example of how to add a row for Model Author, save it and later query it using Django
257+
258+
.. code:: shell
259+
260+
>>> author_kent = Author( first_name="Arthur", last_name="Kent", rating=Decimal("4.1"),)
261+
>>> author_kent.save()
262+
>>> qs1 = Author.objects.all().values("first_name", "last_name")
263+
264+
265+
How to contribute
266+
~~~~~~~~~~~~~~~~~
267+
268+
Contributions to this library are always welcome and highly encouraged.
269+
270+
See `CONTRIBUTING <https://github.com/googleapis/google-cloud-python/blob/main/CONTRIBUTING.md>`_ for more information on how to get started.
271+
272+
Please note that this project is released with a Contributor Code of Conduct.
273+
By participating in this project you agree to abide by its terms. See the `Code
274+
of Conduct <https://github.com/googleapis/google-cloud-python/blob/main/CODE_OF_CONDUCT.md>`_ for more information.
275+
276+
277+
Limitations
278+
~~~~~~~~~~~
279+
280+
Spanner has certain limitations of its own. The full set of limitations is documented
281+
`here <https://cloud.google.com/spanner/quotas#schema_limits>`__.
282+
It is recommended that you go through that list.
283+
284+
Django spanner has a set of limitations as well, which you can find
285+
`here <https://github.com/googleapis/google-cloud-python/blob/main/docs/limitations.rst>`__.
286+
287+
Features from spanner that are not supported in Django-spanner are listed
288+
`here <https://github.com/googleapis/google-cloud-python/blob/main/docs/limitations-spanner.rst>`__.

packages/gcp-sphinx-docfx-yaml/.repo-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"name": "gcp-sphinx-docfx-yaml",
88
"name_pretty": "Sphinx DocFX YAML Generator",
99
"product_documentation": "https://github.com/googleapis/sphinx-docfx-yaml",
10-
"release_level": "preview",
10+
"release_level": "stable",
1111
"repo": "googleapis/google-cloud-python"
1212
}

packages/google-apps-chat/.repo-metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"api_description": "The Google Chat API lets you build Chat apps to integrate your services\nwith Google Chat and manage Chat resources such as spaces, members, and\nmessages.",
23
"api_id": "chat.googleapis.com",
34
"api_shortname": "chat",
45
"client_documentation": "https://googleapis.dev/python/google-apps-chat/latest",

packages/google-apps-chat/README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Python Client for Chat API
33

44
|preview| |pypi| |versions|
55

6-
`Chat API`_:
6+
`Chat API`_: The Google Chat API lets you build Chat apps to integrate your services
7+
with Google Chat and manage Chat resources such as spaces, members, and
8+
messages.
79

810
- `Client Library Documentation`_
911
- `Product Documentation`_

packages/google-apps-chat/docs/README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ Python Client for Chat API
33

44
|preview| |pypi| |versions|
55

6-
`Chat API`_:
6+
`Chat API`_: The Google Chat API lets you build Chat apps to integrate your services
7+
with Google Chat and manage Chat resources such as spaces, members, and
8+
messages.
79

810
- `Client Library Documentation`_
911
- `Product Documentation`_

packages/google-auth/.repo-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"name": "google-auth",
88
"name_pretty": "Google Auth Python Library",
99
"release_level": "stable",
10-
"repo": "googleapis/google-auth-library-python"
10+
"repo": "googleapis/google-cloud-python"
1111
}

packages/google-cloud-alloydb/.repo-metadata.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"api_description": "AlloyDB for PostgreSQL is an open source-compatible database service that\nprovides a powerful option for migrating, modernizing, or building\ncommercial-grade applications. It offers full compatibility with standard\nPostgreSQL, and is more than 4x faster for transactional workloads and up\nto 100x faster for analytical queries than standard PostgreSQL in our\nperformance tests. AlloyDB for PostgreSQL offers a 99.99 percent\navailability SLA inclusive of maintenance. \u003cbr\u003e\u003cbr\u003e AlloyDB is optimized\nfor the most demanding use cases, allowing you to build new applications\nthat require high transaction throughput, large database sizes, or\nmultiple read resources; scale existing PostgreSQL workloads with no\napplication changes; and modernize legacy proprietary databases.",
23
"api_id": "alloydb.googleapis.com",
34
"api_shortname": "alloydb",
45
"client_documentation": "https://cloud.google.com/python/docs/reference/alloydb/latest",

packages/google-cloud-alloydb/README.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ Python Client for AlloyDB
33

44
|preview| |pypi| |versions|
55

6-
`AlloyDB`_:
6+
`AlloyDB`_: AlloyDB for PostgreSQL is an open source-compatible database service that
7+
provides a powerful option for migrating, modernizing, or building
8+
commercial-grade applications. It offers full compatibility with standard
9+
PostgreSQL, and is more than 4x faster for transactional workloads and up
10+
to 100x faster for analytical queries than standard PostgreSQL in our
11+
performance tests. AlloyDB for PostgreSQL offers a 99.99 percent
12+
availability SLA inclusive of maintenance. <br><br> AlloyDB is optimized
13+
for the most demanding use cases, allowing you to build new applications
14+
that require high transaction throughput, large database sizes, or
15+
multiple read resources; scale existing PostgreSQL workloads with no
16+
application changes; and modernize legacy proprietary databases.
717

818
- `Client Library Documentation`_
919
- `Product Documentation`_

0 commit comments

Comments
 (0)