Skip to content

Commit c4f5f91

Browse files
committed
REVERT MERGE
Revert "docs: fix changelog header to consistent size (googleapis#461)" This reverts commit 177e70a. Revert "chore: test minimum dependencies in python 3.7 (googleapis#463)" This reverts commit acc9274. Revert "chore(main): release 1.4.4 (googleapis#462)" This reverts commit 06c0270. Revert "fix: require python 3.7+ (googleapis#468)" This reverts commit 52ec808. Revert "chore(python): fix prerelease session [autoapprove] (googleapis#476)" This reverts commit e894dfa. Revert "chore: add hashes to requirements.txt' (googleapis#483)" This reverts commit cc13fe3. Revert "chore(python): exclude `grpcio==1.49.0rc1` in tests (googleapis#484)" This reverts commit 484d524. Revert "ci(python): fix path to requirements.txt in release script (googleapis#485)" This reverts commit 4f90d90. Revert "chore(python): update .kokoro/requirements.txt (googleapis#486)" This reverts commit 4b37fed. Revert "chore(python): exclude setup.py in renovate config (googleapis#487)" This reverts commit 9ffc736. Revert "chore(deps): update all dependencies (googleapis#488)" This reverts commit 189af9b. Revert "chore: detect samples tests in nested directories (googleapis#492)" This reverts commit f566371. Revert "feat: Allow Users to Supply Their Own BigQuery Client (googleapis#474)" This reverts commit 4f72d4e. Revert "chore: update dependency protobuf >= 3.20.2 (googleapis#498)" This reverts commit f188944. Revert "fix: Sets cache support to false, removes upper req limit (googleapis#499)" This reverts commit be63adc. Revert "fix: updates test to account for UTC in failing test (googleapis#501)" This reverts commit a050ccf. Revert "fix(deps): allow pyarrow version 7+ (googleapis#479)" This reverts commit 0f6be67. Revert "fix: use packaging version parser instead of string splitting (googleapis#513)" This reverts commit bb7f6a7. Revert "chore(main): release 1.5.0 (googleapis#469)" This reverts commit 1ffab57. Revert "chore: addressed lint issue with __version__ (googleapis#534)" This reverts commit 4e17259. Revert "build(deps): bump certifi from 2022.9.24 to 2022.12.7 in /synthtool/gcp/templates/python_library/.kokoro (googleapis#535)" This reverts commit 57794c3.
1 parent 5e52e0a commit c4f5f91

25 files changed

+120
-193
lines changed

.kokoro/continuous/prerelease-deps.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

.kokoro/docker/docs/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ RUN apt-get update \
6060
&& rm -rf /var/lib/apt/lists/* \
6161
&& rm -f /var/cache/apt/archives/*.deb
6262

63-
###################### Install python 3.9.13
63+
###################### Install python 3.8.11
6464

65-
# Download python 3.9.13
66-
RUN wget https://www.python.org/ftp/python/3.9.13/Python-3.9.13.tgz
65+
# Download python 3.8.11
66+
RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz
6767

6868
# Extract files
69-
RUN tar -xvf Python-3.9.13.tgz
69+
RUN tar -xvf Python-3.8.11.tgz
7070

71-
# Install python 3.9.13
72-
RUN ./Python-3.9.13/configure --enable-optimizations
71+
# Install python 3.8.11
72+
RUN ./Python-3.8.11/configure --enable-optimizations
7373
RUN make altinstall
7474

7575
###################### Install pip

.kokoro/presubmit/prerelease-deps.cfg

Lines changed: 0 additions & 7 deletions
This file was deleted.

.kokoro/publish-docs.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ export PYTHONUNBUFFERED=1
2121
export PATH="${HOME}/.local/bin:${PATH}"
2222

2323
# Install nox
24-
python3 -m pip install --require-hashes -r .kokoro/requirements.txt
24+
python3 -m pip install --user --upgrade --quiet nox
2525
python3 -m nox --version
2626

2727
# build docs
2828
nox -s docs
2929

30+
python3 -m pip install --user gcp-docuploader
31+
3032
# create metadata
3133
python3 -m docuploader create-metadata \
3234
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \

.kokoro/release.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
set -eo pipefail
1717

1818
# Start the releasetool reporter
19-
python3 -m pip install --require-hashes -r github/python-bigquery-sqlalchemy/.kokoro/requirements.txt
19+
python3 -m pip install gcp-releasetool
2020
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
2121

22+
# Ensure that we have the latest versions of Twine, Wheel, and Setuptools.
23+
python3 -m pip install --upgrade twine wheel setuptools
24+
2225
# Disable buffering, so that the logs stream through.
2326
export PYTHONUNBUFFERED=1
2427

.kokoro/samples/python3.6/common.cfg

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Build logs will be here
4+
action {
5+
define_artifacts {
6+
regex: "**/*sponge_log.xml"
7+
}
8+
}
9+
10+
# Specify which tests to run
11+
env_vars: {
12+
key: "RUN_TESTS_SESSION"
13+
value: "py-3.6"
14+
}
15+
16+
# Declare build specific Cloud project.
17+
env_vars: {
18+
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
19+
value: "python-docs-samples-tests-py36"
20+
}
21+
22+
env_vars: {
23+
key: "TRAMPOLINE_BUILD_FILE"
24+
value: "github/python-bigquery-sqlalchemy/.kokoro/test-samples.sh"
25+
}
26+
27+
# Configure the docker image for kokoro-trampoline.
28+
env_vars: {
29+
key: "TRAMPOLINE_IMAGE"
30+
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
31+
}
32+
33+
# Download secrets for samples
34+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
35+
36+
# Download trampoline resources.
37+
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
38+
39+
# Use the trampoline script to run in docker.
40+
build_file: "python-bigquery-sqlalchemy/.kokoro/trampoline_v2.sh"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
7+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}
7+
8+
env_vars: {
9+
key: "TRAMPOLINE_BUILD_FILE"
10+
value: "github/python-bigquery-sqlalchemy/.kokoro/test-samples-against-head.sh"
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "False"
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
env_vars: {
4+
key: "INSTALL_LIBRARY_FROM_SOURCE"
5+
value: "True"
6+
}

.kokoro/test-samples-impl.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export PYTHONUNBUFFERED=1
3333
env | grep KOKORO
3434

3535
# Install nox
36-
python3.9 -m pip install --upgrade --quiet nox
36+
python3.6 -m pip install --upgrade --quiet nox
3737

3838
# Use secrets acessor service account to get secrets
3939
if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
@@ -76,7 +76,7 @@ for file in samples/**/requirements.txt; do
7676
echo "------------------------------------------------------------"
7777

7878
# Use nox to execute the tests for the project.
79-
python3.9 -m nox -s "$RUN_TESTS_SESSION"
79+
python3.6 -m nox -s "$RUN_TESTS_SESSION"
8080
EXIT=$?
8181

8282
# If this is a periodic build, send the test log to the FlakyBot.

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
rev: 22.3.0
2626
hooks:
2727
- id: black
28-
- repo: https://github.com/pycqa/flake8
28+
- repo: https://gitlab.com/pycqa/flake8
2929
rev: 3.9.2
3030
hooks:
3131
- id: flake8

README.rst

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ dependencies.
5353

5454
Supported Python Versions
5555
^^^^^^^^^^^^^^^^^^^^^^^^^
56-
Python >= 3.7
56+
Python >= 3.6
5757

5858
Unsupported Python Versions
5959
^^^^^^^^^^^^^^^^^^^^^^^^^^^
60-
Python <= 3.6.
60+
Python <= 3.5.
6161

6262

6363
Mac/Linux
@@ -252,25 +252,6 @@ To create the base64 encoded string you can use the command line tool ``base64``
252252

253253
Alternatively, you can use an online generator like `www.base64encode.org <https://www.base64encode.org>_` to paste your credentials JSON file to be encoded.
254254

255-
256-
Supplying Your Own BigQuery Client
257-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
258-
259-
The above connection string parameters allow you to influence how the BigQuery client used to execute your queries will be instantiated.
260-
If you need additional control, you can supply a BigQuery client of your own:
261-
262-
.. code-block:: python
263-
264-
from google.cloud import bigquery
265-
266-
custom_bq_client = bigquery.Client(...)
267-
268-
engine = create_engine(
269-
'bigquery://some-project/some-dataset?user_supplied_client=True',
270-
connect_args={'client': custom_bq_client},
271-
)
272-
273-
274255
Creating tables
275256
^^^^^^^^^^^^^^^
276257

dev_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ google-cloud-bigquery>=1.6.0
33
future==0.18.2
44
pytest===6.2.5
55
pytest-flake8===1.1.0 # versions 1.1.1 and above require pytest 7
6-
pytz==2022.2.1
6+
pytz==2022.1

renovate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
":preserveSemverRanges",
66
":disableDependencyDashboard"
77
],
8-
"ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt", "setup.py"],
8+
"ignorePaths": [".pre-commit-config.yaml"],
99
"pip_requirements": {
1010
"fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"]
1111
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
attrs==22.1.0
2-
click==8.1.3
3-
google-auth==2.11.0
4-
google-cloud-testutils==1.3.3
1+
attrs==21.4.0
2+
click==8.1.2
3+
google-auth==2.6.2
4+
google-cloud-testutils==1.3.1
55
iniconfig==1.1.1
66
packaging==21.3
77
pluggy==1.0.0
88
py==1.11.0
99
pyasn1==0.4.8
1010
pyasn1-modules==0.2.8
11-
pyparsing==3.0.9
11+
pyparsing==3.0.7
1212
pytest===6.2.5
13-
rsa==4.9
13+
rsa==4.8
1414
six==1.16.0
1515
toml==0.10.2
16-
typing-extensions==4.3.0
16+
typing-extensions==4.1.1

scripts/readme-gen/templates/install_deps.tmpl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Install Dependencies
1212
.. _Python Development Environment Setup Guide:
1313
https://cloud.google.com/python/setup
1414

15-
#. Create a virtualenv. Samples are compatible with Python 3.7+.
15+
#. Create a virtualenv. Samples are compatible with Python 3.6+.
1616

1717
.. code-block:: bash
1818

sqlalchemy_bigquery/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
SQLAlchemy dialect for Google BigQuery
2121
"""
2222

23-
from .version import __version__
23+
from .version import __version__ # noqa
2424

25-
from .base import BigQueryDialect, dialect
25+
from .base import BigQueryDialect, dialect # noqa
2626
from ._types import (
2727
ARRAY,
2828
BIGNUMERIC,
@@ -44,8 +44,6 @@
4444
)
4545

4646
__all__ = [
47-
"__version__",
48-
"dialect",
4947
"ARRAY",
5048
"BIGNUMERIC",
5149
"BigQueryDialect",

sqlalchemy_bigquery/base.py

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from google.cloud.bigquery import dbapi
3333
from google.cloud.bigquery.table import TableReference
3434
from google.api_core.exceptions import NotFound
35-
import packaging.version
35+
3636
import sqlalchemy
3737
import sqlalchemy.sql.expression
3838
import sqlalchemy.sql.functions
@@ -340,18 +340,14 @@ def group_by_clause(self, select, **kw):
340340
# no way to tell sqlalchemy that, so it works harder than
341341
# necessary and makes us do the same.
342342

343-
__sqlalchemy_version_info = packaging.version.parse(sqlalchemy.__version__)
343+
__sqlalchemy_version_info = tuple(map(int, sqlalchemy.__version__.split(".")))
344344

345345
__expanding_text = (
346-
"EXPANDING"
347-
if __sqlalchemy_version_info < packaging.version.parse("1.4")
348-
else "POSTCOMPILE"
346+
"EXPANDING" if __sqlalchemy_version_info < (1, 4) else "POSTCOMPILE"
349347
)
350348

351349
# https://github.com/sqlalchemy/sqlalchemy/commit/f79df12bd6d99b8f6f09d4bf07722638c4b4c159
352-
__expanding_conflict = (
353-
"" if __sqlalchemy_version_info < packaging.version.parse("1.4.27") else "__"
354-
)
350+
__expanding_conflict = "" if __sqlalchemy_version_info < (1, 4, 27) else "__"
355351

356352
__in_expanding_bind = _helpers.substitute_string_re_method(
357353
rf"""
@@ -533,7 +529,7 @@ def visit_bindparam(
533529

534530
if bindparam.expanding: # pragma: NO COVER
535531
assert_(self.__expanded_param(param), f"Unexpected param: {param}")
536-
if self.__sqlalchemy_version_info < packaging.version.parse("1.4.27"):
532+
if self.__sqlalchemy_version_info < (1, 4, 27):
537533
param = param.replace(")", f":{bq_type})")
538534

539535
else:
@@ -737,7 +733,6 @@ class BigQueryDialect(DefaultDialect):
737733
supports_default_values = False
738734
supports_empty_insert = False
739735
supports_multivalues_insert = True
740-
supports_statement_cache = False
741736
supports_unicode_statements = True
742737
supports_unicode_binds = True
743738
supports_native_decimal = True
@@ -806,7 +801,6 @@ def create_connect_args(self, url):
806801
credentials_base64,
807802
default_query_job_config,
808803
list_tables_page_size,
809-
user_supplied_client,
810804
) = parse_url(url)
811805

812806
self.arraysize = arraysize or self.arraysize
@@ -818,21 +812,15 @@ def create_connect_args(self, url):
818812
self._add_default_dataset_to_job_config(
819813
default_query_job_config, project_id, dataset_id
820814
)
821-
822-
if user_supplied_client:
823-
# The user is expected to supply a client with
824-
# create_engine('...', connect_args={'client': bq_client})
825-
return ([], {})
826-
else:
827-
client = _helpers.create_bigquery_client(
828-
credentials_path=self.credentials_path,
829-
credentials_info=self.credentials_info,
830-
credentials_base64=self.credentials_base64,
831-
project_id=project_id,
832-
location=self.location,
833-
default_query_job_config=default_query_job_config,
834-
)
835-
return ([], {"client": client})
815+
client = _helpers.create_bigquery_client(
816+
credentials_path=self.credentials_path,
817+
credentials_info=self.credentials_info,
818+
credentials_base64=self.credentials_base64,
819+
project_id=project_id,
820+
location=self.location,
821+
default_query_job_config=default_query_job_config,
822+
)
823+
return ([client], {})
836824

837825
def _get_table_or_view_names(self, connection, item_types, schema=None):
838826
current_schema = schema or self.dataset_id

0 commit comments

Comments
 (0)