Skip to content

Commit

Permalink
REVERT MERGE
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
atkincaid74 committed Mar 16, 2023
1 parent 5e52e0a commit c4f5f91
Show file tree
Hide file tree
Showing 25 changed files with 120 additions and 193 deletions.
7 changes: 0 additions & 7 deletions .kokoro/continuous/prerelease-deps.cfg

This file was deleted.

12 changes: 6 additions & 6 deletions .kokoro/docker/docs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@ RUN apt-get update \
&& rm -rf /var/lib/apt/lists/* \
&& rm -f /var/cache/apt/archives/*.deb

###################### Install python 3.9.13
###################### Install python 3.8.11

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

# Extract files
RUN tar -xvf Python-3.9.13.tgz
RUN tar -xvf Python-3.8.11.tgz

# Install python 3.9.13
RUN ./Python-3.9.13/configure --enable-optimizations
# Install python 3.8.11
RUN ./Python-3.8.11/configure --enable-optimizations
RUN make altinstall

###################### Install pip
Expand Down
7 changes: 0 additions & 7 deletions .kokoro/presubmit/prerelease-deps.cfg

This file was deleted.

4 changes: 3 additions & 1 deletion .kokoro/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ export PYTHONUNBUFFERED=1
export PATH="${HOME}/.local/bin:${PATH}"

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

# build docs
nox -s docs

python3 -m pip install --user gcp-docuploader

# create metadata
python3 -m docuploader create-metadata \
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
Expand Down
5 changes: 4 additions & 1 deletion .kokoro/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@
set -eo pipefail

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

# Ensure that we have the latest versions of Twine, Wheel, and Setuptools.
python3 -m pip install --upgrade twine wheel setuptools

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

Expand Down
40 changes: 40 additions & 0 deletions .kokoro/samples/python3.6/common.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
}
}

# Specify which tests to run
env_vars: {
key: "RUN_TESTS_SESSION"
value: "py-3.6"
}

# Declare build specific Cloud project.
env_vars: {
key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
value: "python-docs-samples-tests-py36"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-bigquery-sqlalchemy/.kokoro/test-samples.sh"
}

# Configure the docker image for kokoro-trampoline.
env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
}

# Download secrets for samples
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"

# Download trampoline resources.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Use the trampoline script to run in docker.
build_file: "python-bigquery-sqlalchemy/.kokoro/trampoline_v2.sh"
7 changes: 7 additions & 0 deletions .kokoro/samples/python3.6/continuous.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

11 changes: 11 additions & 0 deletions .kokoro/samples/python3.6/periodic-head.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-bigquery-sqlalchemy/.kokoro/test-samples-against-head.sh"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.6/periodic.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "False"
}
6 changes: 6 additions & 0 deletions .kokoro/samples/python3.6/presubmit.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
}
4 changes: 2 additions & 2 deletions .kokoro/test-samples-impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export PYTHONUNBUFFERED=1
env | grep KOKORO

# Install nox
python3.9 -m pip install --upgrade --quiet nox
python3.6 -m pip install --upgrade --quiet nox

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

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

# If this is a periodic build, send the test log to the FlakyBot.
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
23 changes: 2 additions & 21 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ dependencies.

Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
Python >= 3.7
Python >= 3.6

Unsupported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Python <= 3.6.
Python <= 3.5.


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

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


Supplying Your Own BigQuery Client
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The above connection string parameters allow you to influence how the BigQuery client used to execute your queries will be instantiated.
If you need additional control, you can supply a BigQuery client of your own:

.. code-block:: python
from google.cloud import bigquery
custom_bq_client = bigquery.Client(...)
engine = create_engine(
'bigquery://some-project/some-dataset?user_supplied_client=True',
connect_args={'client': custom_bq_client},
)
Creating tables
^^^^^^^^^^^^^^^

Expand Down
2 changes: 1 addition & 1 deletion dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ google-cloud-bigquery>=1.6.0
future==0.18.2
pytest===6.2.5
pytest-flake8===1.1.0 # versions 1.1.1 and above require pytest 7
pytz==2022.2.1
pytz==2022.1
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
":preserveSemverRanges",
":disableDependencyDashboard"
],
"ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt", "setup.py"],
"ignorePaths": [".pre-commit-config.yaml"],
"pip_requirements": {
"fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"]
}
Expand Down
14 changes: 7 additions & 7 deletions samples/snippets/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
attrs==22.1.0
click==8.1.3
google-auth==2.11.0
google-cloud-testutils==1.3.3
attrs==21.4.0
click==8.1.2
google-auth==2.6.2
google-cloud-testutils==1.3.1
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyparsing==3.0.9
pyparsing==3.0.7
pytest===6.2.5
rsa==4.9
rsa==4.8
six==1.16.0
toml==0.10.2
typing-extensions==4.3.0
typing-extensions==4.1.1
2 changes: 1 addition & 1 deletion scripts/readme-gen/templates/install_deps.tmpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Install Dependencies
.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

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

.. code-block:: bash
Expand Down
6 changes: 2 additions & 4 deletions sqlalchemy_bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
SQLAlchemy dialect for Google BigQuery
"""

from .version import __version__
from .version import __version__ # noqa

from .base import BigQueryDialect, dialect
from .base import BigQueryDialect, dialect # noqa
from ._types import (
ARRAY,
BIGNUMERIC,
Expand All @@ -44,8 +44,6 @@
)

__all__ = [
"__version__",
"dialect",
"ARRAY",
"BIGNUMERIC",
"BigQueryDialect",
Expand Down
40 changes: 14 additions & 26 deletions sqlalchemy_bigquery/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from google.cloud.bigquery import dbapi
from google.cloud.bigquery.table import TableReference
from google.api_core.exceptions import NotFound
import packaging.version

import sqlalchemy
import sqlalchemy.sql.expression
import sqlalchemy.sql.functions
Expand Down Expand Up @@ -340,18 +340,14 @@ def group_by_clause(self, select, **kw):
# no way to tell sqlalchemy that, so it works harder than
# necessary and makes us do the same.

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

__expanding_text = (
"EXPANDING"
if __sqlalchemy_version_info < packaging.version.parse("1.4")
else "POSTCOMPILE"
"EXPANDING" if __sqlalchemy_version_info < (1, 4) else "POSTCOMPILE"
)

# https://github.com/sqlalchemy/sqlalchemy/commit/f79df12bd6d99b8f6f09d4bf07722638c4b4c159
__expanding_conflict = (
"" if __sqlalchemy_version_info < packaging.version.parse("1.4.27") else "__"
)
__expanding_conflict = "" if __sqlalchemy_version_info < (1, 4, 27) else "__"

__in_expanding_bind = _helpers.substitute_string_re_method(
rf"""
Expand Down Expand Up @@ -533,7 +529,7 @@ def visit_bindparam(

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

else:
Expand Down Expand Up @@ -737,7 +733,6 @@ class BigQueryDialect(DefaultDialect):
supports_default_values = False
supports_empty_insert = False
supports_multivalues_insert = True
supports_statement_cache = False
supports_unicode_statements = True
supports_unicode_binds = True
supports_native_decimal = True
Expand Down Expand Up @@ -806,7 +801,6 @@ def create_connect_args(self, url):
credentials_base64,
default_query_job_config,
list_tables_page_size,
user_supplied_client,
) = parse_url(url)

self.arraysize = arraysize or self.arraysize
Expand All @@ -818,21 +812,15 @@ def create_connect_args(self, url):
self._add_default_dataset_to_job_config(
default_query_job_config, project_id, dataset_id
)

if user_supplied_client:
# The user is expected to supply a client with
# create_engine('...', connect_args={'client': bq_client})
return ([], {})
else:
client = _helpers.create_bigquery_client(
credentials_path=self.credentials_path,
credentials_info=self.credentials_info,
credentials_base64=self.credentials_base64,
project_id=project_id,
location=self.location,
default_query_job_config=default_query_job_config,
)
return ([], {"client": client})
client = _helpers.create_bigquery_client(
credentials_path=self.credentials_path,
credentials_info=self.credentials_info,
credentials_base64=self.credentials_base64,
project_id=project_id,
location=self.location,
default_query_job_config=default_query_job_config,
)
return ([client], {})

def _get_table_or_view_names(self, connection, item_types, schema=None):
current_schema = schema or self.dataset_id
Expand Down
Loading

0 comments on commit c4f5f91

Please sign in to comment.