sqlalchemy-bigquery 1.14.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,418 @@
1
+ Metadata-Version: 2.1
2
+ Name: sqlalchemy-bigquery
3
+ Version: 1.14.0
4
+ Summary: SQLAlchemy dialect for BigQuery
5
+ Home-page: https://github.com/googleapis/python-bigquery-sqlalchemy
6
+ Author: The Sqlalchemy-Bigquery Authors
7
+ Author-email: googleapis-packages@google.com
8
+ Keywords: bigquery,sqlalchemy
9
+ Platform: Posix; MacOS X; Windows
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Topic :: Database :: Front-Ends
22
+ Obsoletes: pybigquery
23
+ Requires-Python: >=3.8, <3.13
24
+ Description-Content-Type: text/x-rst
25
+ License-File: LICENSE
26
+ License-File: AUTHORS
27
+ Requires-Dist: google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0,>=1.31.5
28
+ Requires-Dist: google-auth<3.0.0,>=1.25.0
29
+ Requires-Dist: google-cloud-bigquery<4.0.0,>=3.3.6
30
+ Requires-Dist: packaging
31
+ Requires-Dist: sqlalchemy<3.0.0,>=1.4.16
32
+ Provides-Extra: alembic
33
+ Requires-Dist: alembic; extra == "alembic"
34
+ Provides-Extra: all
35
+ Requires-Dist: GeoAlchemy2; extra == "all"
36
+ Requires-Dist: pyarrow>=3.0.0; extra == "all"
37
+ Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "all"
38
+ Requires-Dist: shapely; extra == "all"
39
+ Requires-Dist: alembic; extra == "all"
40
+ Requires-Dist: packaging; extra == "all"
41
+ Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.0.0; extra == "all"
42
+ Requires-Dist: pytz; extra == "all"
43
+ Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version >= "3.11" and extra == "all"
44
+ Provides-Extra: bqstorage
45
+ Requires-Dist: google-cloud-bigquery-storage<3.0.0,>=2.0.0; extra == "bqstorage"
46
+ Requires-Dist: grpcio<2.0.0,>=1.47.0; extra == "bqstorage"
47
+ Requires-Dist: pyarrow>=3.0.0; extra == "bqstorage"
48
+ Requires-Dist: grpcio<2.0.0,>=1.49.1; python_version >= "3.11" and extra == "bqstorage"
49
+ Provides-Extra: geography
50
+ Requires-Dist: GeoAlchemy2; extra == "geography"
51
+ Requires-Dist: shapely; extra == "geography"
52
+ Provides-Extra: tests
53
+ Requires-Dist: packaging; extra == "tests"
54
+ Requires-Dist: pytz; extra == "tests"
55
+
56
+ SQLAlchemy Dialect for BigQuery
57
+ ===============================
58
+
59
+ |GA| |pypi| |versions|
60
+
61
+ `SQLALchemy Dialects`_
62
+
63
+ - `Dialect Documentation`_
64
+ - `Product Documentation`_
65
+
66
+ .. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
67
+ :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
68
+ .. |pypi| image:: https://img.shields.io/pypi/v/sqlalchemy-bigquery.svg
69
+ :target: https://pypi.org/project/sqlalchemy-bigquery/
70
+ .. |versions| image:: https://img.shields.io/pypi/pyversions/sqlalchemy-bigquery.svg
71
+ :target: https://pypi.org/project/sqlalchemy-bigquery/
72
+ .. _SQLAlchemy Dialects: https://docs.sqlalchemy.org/en/14/dialects/
73
+ .. _Dialect Documentation: https://googleapis.dev/python/sqlalchemy-bigquery/latest
74
+ .. _Product Documentation: https://cloud.google.com/bigquery/docs/
75
+
76
+
77
+ Quick Start
78
+ -----------
79
+
80
+ In order to use this library, you first need to go through the following steps:
81
+
82
+ 1. `Select or create a Cloud Platform project.`_
83
+ 2. [Optional] `Enable billing for your project.`_
84
+ 3. `Enable the BigQuery Storage API.`_
85
+ 4. `Setup Authentication.`_
86
+
87
+ .. _Select or create a Cloud Platform project.: https://console.cloud.google.com/project
88
+ .. _Enable billing for your project.: https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project
89
+ .. _Enable the BigQuery Storage API.: https://console.cloud.google.com/apis/library/bigquery.googleapis.com
90
+ .. _Setup Authentication.: https://googleapis.dev/python/google-api-core/latest/auth.html
91
+
92
+
93
+ Installation
94
+ ------------
95
+
96
+ Install this library in a `virtualenv`_ using pip. `virtualenv`_ is a tool to
97
+ create isolated Python environments. The basic problem it addresses is one of
98
+ dependencies and versions, and indirectly permissions.
99
+
100
+ With `virtualenv`_, it's possible to install this library without needing system
101
+ install permissions, and without clashing with the installed system
102
+ dependencies.
103
+
104
+ .. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
105
+
106
+
107
+ Supported Python Versions
108
+ ^^^^^^^^^^^^^^^^^^^^^^^^^
109
+ Python >= 3.8
110
+
111
+ Unsupported Python Versions
112
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
113
+ Python <= 3.7.
114
+
115
+
116
+ Mac/Linux
117
+ ^^^^^^^^^
118
+
119
+ .. code-block:: console
120
+
121
+ pip install virtualenv
122
+ virtualenv <your-env>
123
+ source <your-env>/bin/activate
124
+ <your-env>/bin/pip install sqlalchemy-bigquery
125
+
126
+
127
+ Windows
128
+ ^^^^^^^
129
+
130
+ .. code-block:: console
131
+
132
+ pip install virtualenv
133
+ virtualenv <your-env>
134
+ <your-env>\Scripts\activate
135
+ <your-env>\Scripts\pip.exe install sqlalchemy-bigquery
136
+
137
+
138
+ Installations when processing large datasets
139
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140
+
141
+ When handling large datasets, you may see speed increases by also installing the
142
+ `bqstorage` dependencies. See the instructions above about creating a virtual
143
+ environment and then install `sqlalchemy-bigquery` using the `bqstorage` extras:
144
+
145
+ .. code-block:: console
146
+
147
+ source <your-env>/bin/activate
148
+ <your-env>/bin/pip install sqlalchemy-bigquery[bqstorage]
149
+
150
+
151
+ Usage
152
+ -----
153
+
154
+ SQLAlchemy
155
+ ^^^^^^^^^^
156
+
157
+ .. code-block:: python
158
+
159
+ from sqlalchemy import *
160
+ from sqlalchemy.engine import create_engine
161
+ from sqlalchemy.schema import *
162
+ engine = create_engine('bigquery://project')
163
+ table = Table('dataset.table', MetaData(bind=engine), autoload=True)
164
+ print(select([func.count('*')], from_obj=table().scalar()))
165
+
166
+
167
+ Project
168
+ ^^^^^^^
169
+
170
+ ``project`` in ``bigquery://project`` is used to instantiate BigQuery client with the specific project ID. To infer project from the environment, use ``bigquery://`` – without ``project``
171
+
172
+ Authentication
173
+ ^^^^^^^^^^^^^^
174
+
175
+ Follow the `Google Cloud library guide <https://google-cloud-python.readthedocs.io/en/latest/core/auth.html>`_ for authentication.
176
+
177
+ Alternatively, you can choose either of the following approaches:
178
+
179
+ * provide the path to a service account JSON file in ``create_engine()`` using the ``credentials_path`` parameter:
180
+
181
+ .. code-block:: python
182
+
183
+ # provide the path to a service account JSON file
184
+ engine = create_engine('bigquery://', credentials_path='/path/to/keyfile.json')
185
+
186
+ * pass the credentials in ``create_engine()`` as a Python dictionary using the ``credentials_info`` parameter:
187
+
188
+ .. code-block:: python
189
+
190
+ # provide credentials as a Python dictionary
191
+ credentials_info = {
192
+ "type": "service_account",
193
+ "project_id": "your-service-account-project-id"
194
+ }
195
+ engine = create_engine('bigquery://', credentials_info=credentials_info)
196
+
197
+ Location
198
+ ^^^^^^^^
199
+
200
+ To specify location of your datasets pass ``location`` to ``create_engine()``:
201
+
202
+ .. code-block:: python
203
+
204
+ engine = create_engine('bigquery://project', location="asia-northeast1")
205
+
206
+
207
+ Table names
208
+ ^^^^^^^^^^^
209
+
210
+ To query tables from non-default projects or datasets, use the following format for the SQLAlchemy schema name: ``[project.]dataset``, e.g.:
211
+
212
+ .. code-block:: python
213
+
214
+ # If neither dataset nor project are the default
215
+ sample_table_1 = Table('natality', schema='bigquery-public-data.samples')
216
+ # If just dataset is not the default
217
+ sample_table_2 = Table('natality', schema='bigquery-public-data')
218
+
219
+ Batch size
220
+ ^^^^^^^^^^
221
+
222
+ By default, ``arraysize`` is set to ``5000``. ``arraysize`` is used to set the batch size for fetching results. To change it, pass ``arraysize`` to ``create_engine()``:
223
+
224
+ .. code-block:: python
225
+
226
+ engine = create_engine('bigquery://project', arraysize=1000)
227
+
228
+ Page size for dataset.list_tables
229
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230
+
231
+ By default, ``list_tables_page_size`` is set to ``1000``. ``list_tables_page_size`` is used to set the max_results for `dataset.list_tables`_ operation. To change it, pass ``list_tables_page_size`` to ``create_engine()``:
232
+
233
+ .. _`dataset.list_tables`: https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/list
234
+ .. code-block:: python
235
+
236
+ engine = create_engine('bigquery://project', list_tables_page_size=100)
237
+
238
+ Adding a Default Dataset
239
+ ^^^^^^^^^^^^^^^^^^^^^^^^
240
+
241
+ If you want to have the ``Client`` use a default dataset, specify it as the "database" portion of the connection string.
242
+
243
+ .. code-block:: python
244
+
245
+ engine = create_engine('bigquery://project/dataset')
246
+
247
+ When using a default dataset, don't include the dataset name in the table name, e.g.:
248
+
249
+ .. code-block:: python
250
+
251
+ table = Table('table_name')
252
+
253
+ Note that specifying a default dataset doesn't restrict execution of queries to that particular dataset when using raw queries, e.g.:
254
+
255
+ .. code-block:: python
256
+
257
+ # Set default dataset to dataset_a
258
+ engine = create_engine('bigquery://project/dataset_a')
259
+
260
+ # This will still execute and return rows from dataset_b
261
+ engine.execute('SELECT * FROM dataset_b.table').fetchall()
262
+
263
+
264
+ Connection String Parameters
265
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
266
+
267
+ There are many situations where you can't call ``create_engine`` directly, such as when using tools like `Flask SQLAlchemy <http://flask-sqlalchemy.pocoo.org/2.3/>`_. For situations like these, or for situations where you want the ``Client`` to have a `default_query_job_config <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.client.Client.html#google.cloud.bigquery.client.Client>`_, you can pass many arguments in the query of the connection string.
268
+
269
+ The ``credentials_path``, ``credentials_info``, ``credentials_base64``, ``location``, ``arraysize`` and ``list_tables_page_size`` parameters are used by this library, and the rest are used to create a `QueryJobConfig <https://googlecloudplatform.github.io/google-cloud-python/latest/bigquery/generated/google.cloud.bigquery.job.QueryJobConfig.html#google.cloud.bigquery.job.QueryJobConfig>`_
270
+
271
+ Note that if you want to use query strings, it will be more reliable if you use three slashes, so ``'bigquery:///?a=b'`` will work reliably, but ``'bigquery://?a=b'`` might be interpreted as having a "database" of ``?a=b``, depending on the system being used to parse the connection string.
272
+
273
+ Here are examples of all the supported arguments. Any not present are either for legacy sql (which isn't supported by this library), or are too complex and are not implemented.
274
+
275
+ .. code-block:: python
276
+
277
+ engine = create_engine(
278
+ 'bigquery://some-project/some-dataset' '?'
279
+ 'credentials_path=/some/path/to.json' '&'
280
+ 'location=some-location' '&'
281
+ 'arraysize=1000' '&'
282
+ 'list_tables_page_size=100' '&'
283
+ 'clustering_fields=a,b,c' '&'
284
+ 'create_disposition=CREATE_IF_NEEDED' '&'
285
+ 'destination=different-project.different-dataset.table' '&'
286
+ 'destination_encryption_configuration=some-configuration' '&'
287
+ 'dry_run=true' '&'
288
+ 'labels=a:b,c:d' '&'
289
+ 'maximum_bytes_billed=1000' '&'
290
+ 'priority=INTERACTIVE' '&'
291
+ 'schema_update_options=ALLOW_FIELD_ADDITION,ALLOW_FIELD_RELAXATION' '&'
292
+ 'use_query_cache=true' '&'
293
+ 'write_disposition=WRITE_APPEND'
294
+ )
295
+
296
+ In cases where you wish to include the full credentials in the connection URI you can base64 the credentials JSON file and supply the encoded string to the ``credentials_base64`` parameter.
297
+
298
+ .. code-block:: python
299
+
300
+ engine = create_engine(
301
+ 'bigquery://some-project/some-dataset' '?'
302
+ 'credentials_base64=eyJrZXkiOiJ2YWx1ZSJ9Cg==' '&'
303
+ 'location=some-location' '&'
304
+ 'arraysize=1000' '&'
305
+ 'list_tables_page_size=100' '&'
306
+ 'clustering_fields=a,b,c' '&'
307
+ 'create_disposition=CREATE_IF_NEEDED' '&'
308
+ 'destination=different-project.different-dataset.table' '&'
309
+ 'destination_encryption_configuration=some-configuration' '&'
310
+ 'dry_run=true' '&'
311
+ 'labels=a:b,c:d' '&'
312
+ 'maximum_bytes_billed=1000' '&'
313
+ 'priority=INTERACTIVE' '&'
314
+ 'schema_update_options=ALLOW_FIELD_ADDITION,ALLOW_FIELD_RELAXATION' '&'
315
+ 'use_query_cache=true' '&'
316
+ 'write_disposition=WRITE_APPEND'
317
+ )
318
+
319
+ To create the base64 encoded string you can use the command line tool ``base64``, or ``openssl base64``, or ``python -m base64``.
320
+
321
+ Alternatively, you can use an online generator like `www.base64encode.org <https://www.base64encode.org>_` to paste your credentials JSON file to be encoded.
322
+
323
+
324
+ Supplying Your Own BigQuery Client
325
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
326
+
327
+ The above connection string parameters allow you to influence how the BigQuery client used to execute your queries will be instantiated.
328
+ If you need additional control, you can supply a BigQuery client of your own:
329
+
330
+ .. code-block:: python
331
+
332
+ from google.cloud import bigquery
333
+
334
+ custom_bq_client = bigquery.Client(...)
335
+
336
+ engine = create_engine(
337
+ 'bigquery://some-project/some-dataset?user_supplied_client=True',
338
+ connect_args={'client': custom_bq_client},
339
+ )
340
+
341
+
342
+ Creating tables
343
+ ^^^^^^^^^^^^^^^
344
+
345
+ To add metadata to a table:
346
+
347
+ .. code-block:: python
348
+
349
+ table = Table('mytable', ...,
350
+ bigquery_description='my table description',
351
+ bigquery_friendly_name='my table friendly name',
352
+ bigquery_default_rounding_mode="ROUND_HALF_EVEN",
353
+ bigquery_expiration_timestamp=datetime.datetime.fromisoformat("2038-01-01T00:00:00+00:00"),
354
+ )
355
+
356
+ To add metadata to a column:
357
+
358
+ .. code-block:: python
359
+
360
+ Column('mycolumn', doc='my column description')
361
+
362
+ To create a clustered table:
363
+
364
+ .. code-block:: python
365
+
366
+ table = Table('mytable', ..., bigquery_clustering_fields=["a", "b", "c"])
367
+
368
+ To create a time-unit column-partitioned table:
369
+
370
+ .. code-block:: python
371
+
372
+ from google.cloud import bigquery
373
+
374
+ table = Table('mytable', ...,
375
+ bigquery_time_partitioning=bigquery.TimePartitioning(
376
+ field="mytimestamp",
377
+ type_="MONTH",
378
+ expiration_ms=1000 * 60 * 60 * 24 * 30 * 6, # 6 months
379
+ ),
380
+ bigquery_require_partition_filter=True,
381
+ )
382
+
383
+ To create an ingestion-time partitioned table:
384
+
385
+ .. code-block:: python
386
+
387
+ from google.cloud import bigquery
388
+
389
+ table = Table('mytable', ...,
390
+ bigquery_time_partitioning=bigquery.TimePartitioning(),
391
+ bigquery_require_partition_filter=True,
392
+ )
393
+
394
+ To create an integer-range partitioned table
395
+
396
+ .. code-block:: python
397
+
398
+ from google.cloud import bigquery
399
+
400
+ table = Table('mytable', ...,
401
+ bigquery_range_partitioning=bigquery.RangePartitioning(
402
+ field="zipcode",
403
+ range_=bigquery.PartitionRange(start=0, end=100000, interval=10),
404
+ ),
405
+ bigquery_require_partition_filter=True,
406
+ )
407
+
408
+
409
+ Threading and Multiprocessing
410
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
411
+
412
+ Because this client uses the `grpc` library, it's safe to
413
+ share instances across threads.
414
+
415
+ In multiprocessing scenarios, the best
416
+ practice is to create client instances *after* the invocation of
417
+ `os.fork` by `multiprocessing.pool.Pool` or
418
+ `multiprocessing.Process`.
@@ -0,0 +1,22 @@
1
+ sqlalchemy_bigquery/__init__.py,sha256=VUk7PyuIhCKnlD_-du5t1dXw0aM_4pOjEEeKWz2ifKY,2942
2
+ sqlalchemy_bigquery/_helpers.py,sha256=hHq_FXUKIxEXNbxyTrOumTdegbGpEHJyGXZBO2HvSWI,3909
3
+ sqlalchemy_bigquery/_struct.py,sha256=8FXKec6miXfnIIgNU4sOtRmVDLaDW47nawx7GZsKY-c,4382
4
+ sqlalchemy_bigquery/_types.py,sha256=H6GU6rb0uE7WiacdcHeJySxCG4oqZh-1UTAgcOdOqfY,4717
5
+ sqlalchemy_bigquery/_versions_helpers.py,sha256=ChEUHNB1zLfn1RwAiuh3TyyATuq7rdSNAYW-DkKFphs,1050
6
+ sqlalchemy_bigquery/base.py,sha256=MwEc75pmg6f1srDUsrXV9haoiNoT4MZc8oU7CPK_xIQ,54876
7
+ sqlalchemy_bigquery/geography.py,sha256=WDwchFzccGX-JWzUyyD9Ed5vCJ8HNM42AO5bkTtZIII,8638
8
+ sqlalchemy_bigquery/parse_url.py,sha256=MY3WmwdA-6POiMLYRcmbRNr4WskNDcMjmmvixIzCeRc,9854
9
+ sqlalchemy_bigquery/requirements.py,sha256=g-H9wL8nPKQPycpRM6301ilOZdWwCgo_u-Gt2CA88M0,7483
10
+ sqlalchemy_bigquery/version.py,sha256=49aVDNeaKhJDz0fT80dUhM_oaxEmYwBqBc7O7-m6chg,1132
11
+ sqlalchemy_bigquery_vendored/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ sqlalchemy_bigquery_vendored/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
+ sqlalchemy_bigquery_vendored/sqlalchemy/__init__.py,sha256=GC-g9-eNi4h6k1SflXvdZfgL1x-Jm2I1G3bMNgVJpCE,232
14
+ sqlalchemy_bigquery_vendored/sqlalchemy/postgresql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
+ sqlalchemy_bigquery_vendored/sqlalchemy/postgresql/base.py,sha256=MVHIkulrKSWNZ3ufHqXwsqKR3YMCRfVIuB3T4K76Y0Y,615
16
+ sqlalchemy_bigquery-1.14.0.dist-info/AUTHORS,sha256=VFjWT1bATZc1vcMw7xO3Pdbqt9nS2yz9UZ_MrGST9-Q,653
17
+ sqlalchemy_bigquery-1.14.0.dist-info/LICENSE,sha256=qFx6vew4twGGX2m9qhNLIoGr8SznK1UWiRTYdCD95FY,1064
18
+ sqlalchemy_bigquery-1.14.0.dist-info/METADATA,sha256=PZfBVg8p6riFEd8lBOvLYKDh86x3fv6WsSak8pBPTX8,15007
19
+ sqlalchemy_bigquery-1.14.0.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
20
+ sqlalchemy_bigquery-1.14.0.dist-info/entry_points.txt,sha256=v8PQbVkcYJwtle5hojOBu94Jthva1D5Hty4QwMDYTjg,69
21
+ sqlalchemy_bigquery-1.14.0.dist-info/top_level.txt,sha256=YwR1oD5foKmwxej7P4POYaoaxmvIGz_9GSo79BAxkzo,49
22
+ sqlalchemy_bigquery-1.14.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.3.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [sqlalchemy.dialects]
2
+ bigquery = sqlalchemy_bigquery:BigQueryDialect
@@ -0,0 +1,2 @@
1
+ sqlalchemy_bigquery
2
+ sqlalchemy_bigquery_vendored
File without changes
File without changes
@@ -0,0 +1,6 @@
1
+ # __init__.py
2
+ # Copyright (C) 2005-2024 the SQLAlchemy authors and contributors
3
+ # <see AUTHORS file>
4
+ #
5
+ # This module is part of SQLAlchemy and is released under
6
+ # the MIT License: https://www.opensource.org/licenses/mit-license.php
@@ -0,0 +1,19 @@
1
+ # dialects/postgresql/base.py
2
+ # Copyright (C) 2005-2024 the SQLAlchemy authors and contributors
3
+ # <see AUTHORS file>
4
+ #
5
+ # This module is part of SQLAlchemy and is released under
6
+ # the MIT License: https://www.opensource.org/licenses/mit-license.php
7
+ # mypy: ignore-errors
8
+
9
+ from sqlalchemy.sql import compiler
10
+
11
+
12
+ class PGCompiler(compiler.SQLCompiler):
13
+ def update_from_clause(
14
+ self, update_stmt, from_table, extra_froms, from_hints, **kw
15
+ ):
16
+ kw["asfrom"] = True
17
+ return "FROM " + ", ".join(
18
+ t._compiler_dispatch(self, fromhints=from_hints, **kw) for t in extra_froms
19
+ )