From a6f0a5d77053be528a6b6805cb1ff3c8ec465f5e Mon Sep 17 00:00:00 2001 From: Jim Fulton Date: Tue, 10 Aug 2021 10:57:19 -0400 Subject: [PATCH] feat: Rename pybigquery to sqlalchemy-bigquery (#198) --- .coveragerc | 4 +- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .repo-metadata.json | 7 +- AUTHORS | 3 +- CHANGELOG.md | 40 +++++----- CONTRIBUTING.rst | 2 +- README.rst | 35 +++++---- docs/conf.py | 34 ++++++--- docs/index.rst | 14 +--- docs/multiprocessing.rst | 7 -- docs/pybigquery/api.rst | 7 -- noxfile.py | 6 +- owlbot.py | 10 +-- release-procedure.md | 4 +- setup.cfg | 2 +- setup.py | 23 ++++-- .../api.py => sqlalchemy_bigquery/__init__.py | 74 ++++++++++++++----- .../_helpers.py | 2 +- .../base.py | 6 +- .../parse_url.py | 2 +- .../requirements.py | 2 +- .../version.py | 4 +- tests/conftest.py | 13 ++-- .../sqlalchemy_dialect_compliance/README.rst | 6 +- .../sqlalchemy_dialect_compliance/conftest.py | 12 +-- .../test_dialect_compliance.py | 2 +- tests/system/__init__.py | 2 +- tests/system/conftest.py | 2 +- tests/system/test_alembic.py | 2 +- tests/system/test_helpers.py | 4 +- tests/system/test_sqlalchemy_bigquery.py | 22 +----- tests/unit/conftest.py | 4 +- tests/unit/fauxdbi.py | 7 +- tests/unit/test_api.py | 37 ---------- tests/unit/test_catalog_functions.py | 2 +- tests/unit/test_comments.py | 2 +- tests/unit/test_compiler.py | 2 +- tests/unit/test_compliance.py | 2 +- tests/unit/test_dialect_types.py | 7 +- tests/unit/test_engine.py | 2 +- tests/unit/test_helpers.py | 4 +- tests/unit/test_like_reescape.py | 4 +- tests/unit/test_parse_url.py | 6 +- tests/unit/test_select.py | 6 +- tests/unit/test_sqlalchemy_bigquery.py | 6 +- tests/unit/test_view.py | 2 +- 46 files changed, 224 insertions(+), 224 deletions(-) delete mode 100644 docs/multiprocessing.rst delete mode 100644 docs/pybigquery/api.rst rename pybigquery/api.py => sqlalchemy_bigquery/__init__.py (52%) rename {pybigquery => sqlalchemy_bigquery}/_helpers.py (97%) rename pybigquery/sqlalchemy_bigquery.py => sqlalchemy_bigquery/base.py (99%) rename {pybigquery => sqlalchemy_bigquery}/parse_url.py (99%) rename {pybigquery => sqlalchemy_bigquery}/requirements.py (99%) rename pybigquery/__init__.py => sqlalchemy_bigquery/version.py (93%) delete mode 100644 tests/unit/test_api.py diff --git a/.coveragerc b/.coveragerc index 9b612b9b..32fdaa09 100644 --- a/.coveragerc +++ b/.coveragerc @@ -18,7 +18,7 @@ [run] branch = True omit = - pybigquery/requirements.py + sqlalchemy_bigquery/requirements.py [report] fail_under = 100 @@ -35,4 +35,4 @@ omit = */proto/*.py */core/*.py */site-packages/*.py - pybigquery/requirements.py + sqlalchemy_bigquery/requirements.py diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index f1e69f11..4caf4e60 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -20,7 +20,7 @@ If you are still having issues, please be sure to include as much information as - OS type and version: - Python version: `python --version` - pip version: `pip --version` - - `pybigquery` version: `pip show pybigquery` + - `sqlalchemy-bigquery` version: `pip show sqlalchemy-bigquery` #### Steps to reproduce diff --git a/.repo-metadata.json b/.repo-metadata.json index 8c2815f3..ae545b37 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,11 +1,12 @@ { - "name": "pybigquery", + "name": "sqlalchemy-bigquery", "name_pretty": "SQLAlchemy dialect for BigQuery", - "client_documentation": "https://github.com/googleapis/pybigquery", + "client_documentation": + "https://googleapis.dev/python/sqlalchemy-bigquery/latest/index.html", "release_level": "beta", "language": "python", "library_type": "INTEGRATION", "repo": "googleapis/python-bigquery-sqlalchemy", - "distribution_name": "pybigquery", + "distribution_name": "sqlalchemy-bigquery", "api_id": "bigquery.googleapis.com" } diff --git a/AUTHORS b/AUTHORS index ef29a573..5daa663b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,4 @@ -# This is the list of pybigquery's significant contributors. +# This is the list of sqlalchemy-bigquery's significant contributors. # # This does not necessarily list everyone who has contributed code, # especially since many employees of one corporation may be contributing. @@ -12,6 +12,7 @@ Google LLC Harshal Sheth Jacob Hayes James Campbell +Jim Fulton Joshua Carp Kurian (kuriancheeramelil) Maksym Voitko diff --git a/CHANGELOG.md b/CHANGELOG.md index 70963b8e..e6cbe8b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,31 +1,41 @@ # Changelog -[PyPI History][1] +Older versions of this project were distributed as [pybigquery][0]. -[1]: https://pypi.org/project/pybigquery/#history +[0]: https://pypi.org/project/pybigquery -### [0.10.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.10.0...v0.10.1) (2021-07-30) +[sqlalchemy-bigquery PyPI History][1] + +[1]: https://pypi.org/project/sqlalchemy-bigquery/#history + + +[pybigquery PyPI History][2] + +[2]: https://pypi.org/project/pybigquery/#history + + +## [pybigquery 0.10.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.10.0...v0.10.1) (2021-07-30) ### Bug Fixes * **deps:** pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions ([#220](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/220)) ([bf1f47c](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/bf1f47c794e747a2ea878347322c040636e8c2d4)) -## [0.10.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.9.1...v0.10.0) (2021-07-06) +## [pybigquery 0.10.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.9.1...v0.10.0) (2021-07-06) ### Features * There's a new `page_size` option to control the page size used when listing tables. ([#174](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/174)) ([e0f1496](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/e0f1496c99dd627e0ed04a0c4e89ca5b14611be2)) -### [0.9.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.9.0...v0.9.1) (2021-06-25) +## [pybigquery 0.9.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.9.0...v0.9.1) (2021-06-25) ### Documentation * omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([d52334c](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/d52334c3290d8356a26e1c9fc54dae75854410c9)) -## [0.9.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.8.0...v0.9.0) (2021-05-25) +## [pybigquery 0.9.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.8.0...v0.9.0) (2021-05-25) ### Features @@ -33,14 +43,14 @@ * Alembic support ([#183](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/183)) ([4d5a17c](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/4d5a17c8f63328d4484ea7b2ccc58334a421ba81)) * Support parameterized NUMERIC, BIGNUMERIC, STRING, and BYTES types ([#180](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/180)) ([d118238](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/d1182385b9f1551e605acdc7e2dd45dff22c8064)) -## [0.8.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.7.0...v0.8.0) (2021-05-21) +## [pybigquery 0.8.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.7.0...v0.8.0) (2021-05-21) ### Features * Add support for SQLAlchemy 1.4 ([#177](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/177)) ([b7b6000](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/b7b60007c966cd548448d1d6fd5a14d1f89480cd)) -## [0.7.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.6.1...v0.7.0) (2021-05-12) +## [pybigquery 0.7.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.6.1...v0.7.0) (2021-05-12) ### Features @@ -64,14 +74,14 @@ - Get view definitions. -### [0.6.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.6.0...v0.6.1) (2021-04-12) +## [pybigquery 0.6.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.6.0...v0.6.1) (2021-04-12) ### Bug Fixes * use `project_id` property from service account credentials ([#120](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/120)) ([ab2051d](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/ab2051de3097adb68503c01a87f9a91092711d2a)) -## [0.6.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.5.1...v0.6.0) (2021-04-06) +## [pybigquery 0.6.0](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.5.1...v0.6.0) (2021-04-06) ### Features @@ -83,7 +93,7 @@ * correct classifiers in `setup.py` ([#107](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/107)) ([0cfc5de](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/0cfc5de467823998ba72af1fee1d2a8aa865fabc)) -### [0.5.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.5.0...v0.5.1) (2021-04-01) +## [pybigquery 0.5.1](https://www.github.com/googleapis/python-bigquery-sqlalchemy/compare/v0.5.0...v0.5.1) (2021-04-01) ### Bug Fixes @@ -96,9 +106,7 @@ * add templates for move to googleapis/python-bigquery-sqlalchemy repo ([#88](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/88)) ([37e584e](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/37e584e05db6316b4abd41ebc08486047d2c49b8)) * build documentation with Sphinx ([#97](https://www.github.com/googleapis/python-bigquery-sqlalchemy/issues/97)) ([1707737](https://www.github.com/googleapis/python-bigquery-sqlalchemy/commit/1707737c60997e9714387c8077727eb5918626bb)) -## 0.5.0 - -2020-11-18 +## pybigquery 0.5.0 (2020-11-18) ### ⚠️ Breaking Changes ⚠️ @@ -118,9 +126,7 @@ - Use flake8 for code style checks. ([#71](https://github.com/mxmzdlv/pybigquery/pull/71)) -## 0.4.15 - -2020-04-23 +## pybigquery 0.4.15 (2020-04-23) ### Implementation Changes diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 54003910..b6278e10 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -212,7 +212,7 @@ instead of ``https://github.com/googleapis/python-bigquery-sqlalchemy/blob/master/CONTRIBUTING.rst``) may cause problems creating links or rendering the description. -.. _description on PyPI: https://pypi.org/project/pybigquery +.. _description on PyPI: https://pypi.org/project/sqlalchemy-bigquery ************************* diff --git a/README.rst b/README.rst index fb3a8fb1..89ea89b5 100644 --- a/README.rst +++ b/README.rst @@ -10,12 +10,12 @@ SQLAlchemy Dialect for BigQuery .. |beta| image:: https://img.shields.io/badge/support-beta-orange.svg :target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#beta-support -.. |pypi| image:: https://img.shields.io/pypi/v/pybigquery.svg - :target: https://pypi.org/project/pybigquery/ -.. |versions| image:: https://img.shields.io/pypi/pyversions/pybigquery.svg - :target: https://pypi.org/project/pybigquery/ +.. |pypi| image:: https://img.shields.io/pypi/v/sqlalchemy-bigquery.svg + :target: https://pypi.org/project/sqlalchemy-bigquery/ +.. |versions| image:: https://img.shields.io/pypi/pyversions/sqlalchemy-bigquery.svg + :target: https://pypi.org/project/sqlalchemy-bigquery/ .. _SQLAlchemy Dialects: https://docs.sqlalchemy.org/en/14/dialects/ -.. _Dialect Documentation: https://googleapis.dev/python/pybigquery/latest +.. _Dialect Documentation: https://googleapis.dev/python/sqlalchemy-bigquery/latest .. _Product Documentation: https://cloud.google.com/bigquery/docs/ @@ -65,7 +65,7 @@ Mac/Linux pip install virtualenv virtualenv source /bin/activate - /bin/pip install pybigquery + /bin/pip install sqlalchemy-bigquery Windows @@ -76,7 +76,7 @@ Windows pip install virtualenv virtualenv \Scripts\activate - \Scripts\pip.exe install pybigquery + \Scripts\pip.exe install sqlalchemy-bigquery Usage ----- @@ -93,15 +93,6 @@ SQLAlchemy table = Table('dataset.table', MetaData(bind=engine), autoload=True) print(select([func.count('*')], from_obj=table).scalar()) -API Client -^^^^^^^^^^ - -.. code-block:: python - - from pybigquery.api import ApiClient - api_client = ApiClient() - print(api_client.dry_run_query(query=sqlstr).total_bytes_processed) - Project ^^^^^^^ @@ -231,3 +222,15 @@ To add metadata to a column: .. code-block:: python Column('mycolumn', doc='my column description') + + +Threading and Multiprocessing +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Because this client uses the `grpc` library, it's safe to +share instances across threads. + +In multiprocessing scenarios, the best +practice is to create client instances *after* the invocation of +`os.fork` by `multiprocessing.pool.Pool` or +`multiprocessing.Process`. diff --git a/docs/conf.py b/docs/conf.py index 62dedd27..f5b10607 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# pybigquery documentation build configuration file +# sqlalchemy-bigquery documentation build configuration file # # This file is execfile()d with the current directory set to its # containing dir. @@ -80,7 +80,7 @@ master_doc = "index" # General information about the project. -project = "pybigquery" +project = "sqlalchemy-bigquery" copyright = "2019, Google" author = "Google APIs" @@ -153,7 +153,7 @@ # further. For a list of options available for each theme, see the # documentation. html_theme_options = { - "description": "Google Cloud Client Libraries for pybigquery", + "description": "Google Cloud Client Libraries for sqlalchemy-bigquery", "github_user": "googleapis", "github_repo": "python-bigquery-sqlalchemy", "github_banner": True, @@ -247,7 +247,7 @@ # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = "pybigquery-doc" +htmlhelp_basename = "sqlalchemy-bigquery-doc" # -- Options for warnings ------------------------------------------------------ @@ -278,7 +278,13 @@ # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, "pybigquery.tex", "pybigquery Documentation", author, "manual",) + ( + master_doc, + "sqlalchemy-bigquery.tex", + "sqlalchemy-bigquery Documentation", + author, + "manual", + ) ] # The name of an image file (relative to this directory) to place at the top of @@ -306,7 +312,15 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [(master_doc, "pybigquery", "pybigquery Documentation", [author], 1,)] +man_pages = [ + ( + master_doc, + "sqlalchemy-bigquery", + "sqlalchemy-bigquery Documentation", + [author], + 1, + ) +] # If true, show URL addresses after external links. # man_show_urls = False @@ -320,11 +334,11 @@ texinfo_documents = [ ( master_doc, - "pybigquery", - "pybigquery Documentation", + "sqlalchemy-bigquery", + "sqlalchemy-bigquery Documentation", author, - "pybigquery", - "pybigquery Library", + "sqlalchemy-bigquery", + "sqlalchemy-bigquery Library", "APIs", ) ] diff --git a/docs/index.rst b/docs/index.rst index 0e255b3e..eef073c6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,20 +1,14 @@ -.. include:: README.rst -.. include:: multiprocessing.rst - -.. include:: alembic.rst - -API Reference -------------- .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - pybigquery/api + README + alembic Changelog --------- -For a list of all ``pybigquery`` releases: +For a list of all ``sqlalchemy-bigquery`` releases: .. toctree:: :maxdepth: 2 diff --git a/docs/multiprocessing.rst b/docs/multiprocessing.rst deleted file mode 100644 index 536d17b2..00000000 --- a/docs/multiprocessing.rst +++ /dev/null @@ -1,7 +0,0 @@ -.. note:: - - Because this client uses :mod:`grpc` library, it is safe to - share instances across threads. In multiprocessing scenarios, the best - practice is to create client instances *after* the invocation of - :func:`os.fork` by :class:`multiprocessing.pool.Pool` or - :class:`multiprocessing.Process`. diff --git a/docs/pybigquery/api.rst b/docs/pybigquery/api.rst deleted file mode 100644 index bc9923e5..00000000 --- a/docs/pybigquery/api.rst +++ /dev/null @@ -1,7 +0,0 @@ -PyBigQuery API -============== - -.. automodule:: pybigquery.api - :members: - :undoc-members: - :inherited-members: diff --git a/noxfile.py b/noxfile.py index d25f5877..8044a405 100644 --- a/noxfile.py +++ b/noxfile.py @@ -25,7 +25,7 @@ BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "pybigquery", "tests", "noxfile.py", "setup.py"] +BLACK_PATHS = ["docs", "sqlalchemy_bigquery", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -63,7 +63,7 @@ def lint(session): session.run( "black", "--check", *BLACK_PATHS, ) - session.run("flake8", "pybigquery", "tests") + session.run("flake8", "sqlalchemy_bigquery", "tests") @nox.session(python=DEFAULT_PYTHON_VERSION) @@ -114,7 +114,7 @@ def default(session): "py.test", "--quiet", f"--junitxml=unit_{session.python}_sponge_log.xml", - "--cov=pybigquery", + "--cov=sqlalchemy_bigquery", "--cov=tests/unit", "--cov-append", "--cov-config=.coveragerc", diff --git a/owlbot.py b/owlbot.py index 9f3ddc6f..97b3ae84 100644 --- a/owlbot.py +++ b/owlbot.py @@ -33,7 +33,7 @@ cov_level=100 ) s.move(templated_files, excludes=[ - # pybigquery was originally licensed MIT + # sqlalchemy-bigquery was originally licensed MIT "LICENSE" ]) @@ -44,17 +44,17 @@ s.replace( [".coveragerc"], "google/cloud/__init__.py", - "pybigquery/requirements.py", + "sqlalchemy_bigquery/requirements.py", ) s.replace( ["noxfile.py"], r"[\"']google[\"']", - '"pybigquery"', + '"sqlalchemy_bigquery"', ) s.replace( - ["noxfile.py"], "google/cloud", "pybigquery", + ["noxfile.py"], "google/cloud", "sqlalchemy_bigquery", ) def place_before(path, text, *before_text, escape=None): @@ -192,7 +192,7 @@ def compliance(session): """universal = 1 [sqla_testing] -requirement_cls=pybigquery.requirements:Requirements +requirement_cls=sqlalchemy_bigquery.requirements:Requirements profile_file=.sqlalchemy_dialect_compliance-profiles.txt [tool:pytest] diff --git a/release-procedure.md b/release-procedure.md index 61e4e1ef..ba5291dd 100644 --- a/release-procedure.md +++ b/release-procedure.md @@ -1,4 +1,4 @@ -# pybigquery release procedure +# sqlalchemy-bigquery release procedure * Checkout master branch @@ -26,7 +26,7 @@ * Try out test PyPI package - pip install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pybigquery + pip install --upgrade --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple sqlalchemy-bigquery * Upload to PyPI diff --git a/setup.cfg b/setup.cfg index 71e80492..0018dd1e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,7 +19,7 @@ universal = 1 [sqla_testing] -requirement_cls=pybigquery.requirements:Requirements +requirement_cls=sqlalchemy_bigquery.requirements:Requirements profile_file=.sqlalchemy_dialect_compliance-profiles.txt [tool:pytest] diff --git a/setup.py b/setup.py index e0b2ccec..290ecdd3 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -19,12 +19,13 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import io +import os +import re from setuptools import setup # Package metadata. -name = "pybigquery" -version = "0.10.1" +name = "sqlalchemy-bigquery" description = "SQLAlchemy dialect for BigQuery" # Should be one of: @@ -33,6 +34,10 @@ # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 4 - Beta" +package_root = os.path.abspath(os.path.dirname(__file__)) +with open(os.path.join(package_root, "sqlalchemy_bigquery", "version.py")) as f: + version = re.search('__version__ = "([^"]+)"', f.read()).group(1) + def readme(): with io.open("README.rst", "r", encoding="utf8") as f: @@ -45,9 +50,9 @@ def readme(): description=description, long_description=readme(), long_description_content_type="text/x-rst", - author="The PyBigQuery Authors", + author="The Sqlalchemy-Bigquery Authors", author_email="googleapis-packages@google.com", - packages=["pybigquery"], + packages=["sqlalchemy_bigquery"], url="https://github.com/googleapis/python-bigquery-sqlalchemy", keywords=["bigquery", "sqlalchemy"], classifiers=[ @@ -77,8 +82,10 @@ def readme(): python_requires=">=3.6, <3.10", tests_require=["pytz"], entry_points={ - "sqlalchemy.dialects": [ - "bigquery = pybigquery.sqlalchemy_bigquery:BigQueryDialect" - ] + "sqlalchemy.dialects": ["bigquery = sqlalchemy_bigquery:BigQueryDialect"] }, + # Document that this replaces pybigquery, however, this isn't + # enforced by pip, because doing so would allow rogue packages to + # obsolete legitimate ones. + obsoletes=["pybigquery"], ) diff --git a/pybigquery/api.py b/sqlalchemy_bigquery/__init__.py similarity index 52% rename from pybigquery/api.py rename to sqlalchemy_bigquery/__init__.py index f8e1894e..fb08e576 100644 --- a/pybigquery/api.py +++ b/sqlalchemy_bigquery/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -16,27 +16,61 @@ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" +SQLAlchemy dialect for Google BigQuery +""" -"""Integration with BigQuery API.""" +from .version import __version__ -from __future__ import absolute_import -from __future__ import unicode_literals +from .base import BigQueryDialect +from .base import ( + STRING, + BOOL, + BOOLEAN, + INT64, + INTEGER, + FLOAT64, + FLOAT, + TIMESTAMP, + DATETIME, + DATE, + BYTES, + TIME, + RECORD, + NUMERIC, + BIGNUMERIC, +) -from google.cloud.bigquery import QueryJobConfig +__all__ = [ + "__version__", + "BigQueryDialect", + "STRING", + "BOOL", + "BOOLEAN", + "INT64", + "INTEGER", + "FLOAT64", + "FLOAT", + "TIMESTAMP", + "DATETIME", + "DATE", + "BYTES", + "TIME", + "RECORD", + "NUMERIC", + "BIGNUMERIC", +] -from pybigquery import _helpers +try: + import pybigquery # noqa +except ImportError: + pass +else: # pragma: NO COVER + import warnings - -class ApiClient(object): - def __init__(self, credentials_path=None, location=None): - self.credentials_path = credentials_path - self.location = location - self.client = _helpers.create_bigquery_client( - credentials_path=credentials_path, location=location - ) - - def dry_run_query(self, query): - job_config = QueryJobConfig() - job_config.dry_run = True - job_config.use_query_cache = False - return self.client.query(query=(query), job_config=job_config) + warnings.warn( + "Obsolete pybigquery is installed, which is likely to\n" + "interfere with sqlalchemy_bigquery.\n" + "pybigquery should be uninstalled.", + stacklevel=2, + ) diff --git a/pybigquery/_helpers.py b/sqlalchemy_bigquery/_helpers.py similarity index 97% rename from pybigquery/_helpers.py rename to sqlalchemy_bigquery/_helpers.py index 2b1648ed..95ca4b17 100644 --- a/pybigquery/_helpers.py +++ b/sqlalchemy_bigquery/_helpers.py @@ -1,4 +1,4 @@ -# Copyright 2021 The PyBigQuery Authors +# Copyright 2021 The sqlalchemy-bigquery Authors # # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at diff --git a/pybigquery/sqlalchemy_bigquery.py b/sqlalchemy_bigquery/base.py similarity index 99% rename from pybigquery/sqlalchemy_bigquery.py rename to sqlalchemy_bigquery/base.py index 795f7c33..db7336f6 100644 --- a/pybigquery/sqlalchemy_bigquery.py +++ b/sqlalchemy_bigquery/base.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -53,7 +53,7 @@ import re from .parse_url import parse_url -from pybigquery import _helpers +from sqlalchemy_bigquery import _helpers FIELD_ILLEGAL_CHARACTERS = re.compile(r"[^\w]+") @@ -981,5 +981,5 @@ def get_view_definition(self, connection, view_name, schema=None, **kw): else: from alembic.ddl import impl - class PyBigQueryImpl(impl.DefaultImpl): + class SqlalchemyBigqueryImpl(impl.DefaultImpl): __dialect__ = "bigquery" diff --git a/pybigquery/parse_url.py b/sqlalchemy_bigquery/parse_url.py similarity index 99% rename from pybigquery/parse_url.py rename to sqlalchemy_bigquery/parse_url.py index 370a46c7..aeb1196e 100644 --- a/pybigquery/parse_url.py +++ b/sqlalchemy_bigquery/parse_url.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/pybigquery/requirements.py b/sqlalchemy_bigquery/requirements.py similarity index 99% rename from pybigquery/requirements.py rename to sqlalchemy_bigquery/requirements.py index 0be21a85..90cc08db 100644 --- a/pybigquery/requirements.py +++ b/sqlalchemy_bigquery/requirements.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/pybigquery/__init__.py b/sqlalchemy_bigquery/version.py similarity index 93% rename from pybigquery/__init__.py rename to sqlalchemy_bigquery/version.py index 947b72ad..fa3a9cd6 100644 --- a/pybigquery/__init__.py +++ b/sqlalchemy_bigquery/version.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -16,3 +16,5 @@ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__version__ = "1.0.0-a1" diff --git a/tests/conftest.py b/tests/conftest.py index 3ddf981e..479128ab 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -19,9 +19,10 @@ from sqlalchemy.dialects import registry -registry.register("bigquery", "pybigquery.sqlalchemy_bigquery", "BigQueryDialect") +registry.register("bigquery", "sqlalchemy_bigquery", "BigQueryDialect") -# sqlalchemy's dialect-testing machinery wants an entry like this. It is wack. :( -registry.register( - "bigquery.bigquery", "pybigquery.sqlalchemy_bigquery", "BigQueryDialect" -) +# sqlalchemy's dialect-testing machinery wants an entry like this. +# This seems to be based around dialects maybe having multiple drivers +# and wanting to test drover-specific URLs, but doesn't seem to make +# much sense for dialects with only one driver. ¯\_(ツ)_/¯ +registry.register("bigquery.bigquery", "sqlalchemy_bigquery", "BigQueryDialect") diff --git a/tests/sqlalchemy_dialect_compliance/README.rst b/tests/sqlalchemy_dialect_compliance/README.rst index 8e497528..096502b3 100644 --- a/tests/sqlalchemy_dialect_compliance/README.rst +++ b/tests/sqlalchemy_dialect_compliance/README.rst @@ -8,6 +8,6 @@ SQLAlchemy dialect. These are "system" tests, meaning that they run against a real BigQuery account. To run the tests, you need a BigQuery account with -empty `test_pybigquery_sqla` and `test_schema` schemas. You need to -have the `GOOGLE_APPLICATION_CREDENTIALS` environment variable set to -the path of a Google Cloud authentication file. +empty `test_schema` schema. Other test schemas will be created on the +fly. You need to have the `GOOGLE_APPLICATION_CREDENTIALS` environment +variable set to the path of a Google Cloud authentication file. diff --git a/tests/sqlalchemy_dialect_compliance/conftest.py b/tests/sqlalchemy_dialect_compliance/conftest.py index 3ad9a50b..0b6bc401 100644 --- a/tests/sqlalchemy_dialect_compliance/conftest.py +++ b/tests/sqlalchemy_dialect_compliance/conftest.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -31,13 +31,15 @@ import google.cloud.bigquery.dbapi.connection import test_utils.prefixer -import pybigquery.sqlalchemy_bigquery +import sqlalchemy_bigquery.base + +sqlalchemy_bigquery.BigQueryDialect.preexecute_autoincrement_sequences = True + prefixer = test_utils.prefixer.Prefixer( "python-bigquery-sqlalchemy", "tests/compliance" ) -pybigquery.sqlalchemy_bigquery.BigQueryDialect.preexecute_autoincrement_sequences = True google.cloud.bigquery.dbapi.connection.Connection.rollback = lambda self: None _where = re.compile(r"\s+WHERE\s+", re.IGNORECASE).search @@ -51,7 +53,7 @@ def visit_delete(self, delete_stmt, *args, **kw): - text = super(pybigquery.sqlalchemy_bigquery.BigQueryCompiler, self).visit_delete( + text = super(sqlalchemy_bigquery.base.BigQueryCompiler, self).visit_delete( delete_stmt, *args, **kw ) @@ -63,7 +65,7 @@ def visit_delete(self, delete_stmt, *args, **kw): return text -pybigquery.sqlalchemy_bigquery.BigQueryCompiler.visit_delete = visit_delete +sqlalchemy_bigquery.base.BigQueryCompiler.visit_delete = visit_delete def pytest_sessionstart(session): diff --git a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py index e85dd541..c126c4f7 100644 --- a/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py +++ b/tests/sqlalchemy_dialect_compliance/test_dialect_compliance.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/system/__init__.py b/tests/system/__init__.py index 947b72ad..244012f6 100644 --- a/tests/system/__init__.py +++ b/tests/system/__init__.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/system/conftest.py b/tests/system/conftest.py index 639ba636..3b3bda8e 100644 --- a/tests/system/conftest.py +++ b/tests/system/conftest.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/system/test_alembic.py b/tests/system/test_alembic.py index 49b0af10..db9ceb4f 100644 --- a/tests/system/test_alembic.py +++ b/tests/system/test_alembic.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/system/test_helpers.py b/tests/system/test_helpers.py index 18334631..5d4e7c71 100644 --- a/tests/system/test_helpers.py +++ b/tests/system/test_helpers.py @@ -1,4 +1,4 @@ -# Copyright 2021 The PyBigQuery Authors +# Copyright 2021 The sqlalchemy-bigquery Authors # # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at @@ -12,7 +12,7 @@ @pytest.fixture(scope="session") def module_under_test(): - from pybigquery import _helpers + from sqlalchemy_bigquery import _helpers return _helpers diff --git a/tests/system/test_sqlalchemy_bigquery.py b/tests/system/test_sqlalchemy_bigquery.py index da863dc0..0fe878b2 100644 --- a/tests/system/test_sqlalchemy_bigquery.py +++ b/tests/system/test_sqlalchemy_bigquery.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -20,9 +20,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from google.api_core.exceptions import BadRequest -from pybigquery.api import ApiClient -from pybigquery.sqlalchemy_bigquery import BigQueryDialect +from sqlalchemy_bigquery import BigQueryDialect from sqlalchemy.engine import create_engine from sqlalchemy.schema import Table, MetaData, Column from sqlalchemy.ext.declarative import declarative_base @@ -229,22 +227,6 @@ def query(table): return query -@pytest.fixture(scope="session") -def api_client(): - return ApiClient() - - -def test_dry_run(engine, api_client, bigquery_dataset): - sql = f"SELECT * FROM {bigquery_dataset}.sample_one_row" - assert api_client.dry_run_query(sql).total_bytes_processed == 148 - - sql = "SELECT * FROM sample_one_row" - with pytest.raises(BadRequest) as excinfo: - api_client.dry_run_query(sql) - expected_message = 'Table name "sample_one_row" missing dataset while no default dataset is set in the request.' - assert expected_message in str(excinfo.value.message) - - def test_engine_with_dataset(engine_using_test_dataset, bigquery_dataset): rows = engine_using_test_dataset.execute("SELECT * FROM sample_one_row").fetchall() assert list(rows[0]) == ONE_ROW_CONTENTS diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index aa23fe22..1c78b12d 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -50,7 +50,7 @@ def factory(*args, **kw): with mock.patch("google.cloud.bigquery.dbapi.connection.Connection", factory): # We want to bypass client creation. We don't need it and it requires creds. with mock.patch( - "pybigquery._helpers.create_bigquery_client", fauxdbi.FauxClient + "sqlalchemy_bigquery._helpers.create_bigquery_client", fauxdbi.FauxClient ): with mock.patch("google.auth.default", return_value=("authdb", "authproj")): engine = sqlalchemy.create_engine("bigquery://myproject/mydataset") diff --git a/tests/unit/fauxdbi.py b/tests/unit/fauxdbi.py index 23d832f1..56c44e0f 100644 --- a/tests/unit/fauxdbi.py +++ b/tests/unit/fauxdbi.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -30,7 +30,10 @@ import google.cloud.bigquery.table import google.cloud.bigquery.dbapi.cursor -from pybigquery._helpers import substitute_re_method, substitute_string_re_method +from sqlalchemy_bigquery._helpers import ( + substitute_re_method, + substitute_string_re_method, +) class Connection: diff --git a/tests/unit/test_api.py b/tests/unit/test_api.py deleted file mode 100644 index 61190e7f..00000000 --- a/tests/unit/test_api.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2021 The PyBigQuery Authors -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -# the Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -import mock - - -def test_dry_run(): - - with mock.patch("pybigquery._helpers.create_bigquery_client") as create_client: - import pybigquery.api - - client = pybigquery.api.ApiClient("/my/creds", "mars") - create_client.assert_called_once_with( - credentials_path="/my/creds", location="mars" - ) - client.dry_run_query("select 42") - [(name, args, kwargs)] = create_client.return_value.query.mock_calls - job_config = kwargs.pop("job_config") - assert (name, args, kwargs) == ("", (), {"query": "select 42"}) - assert job_config.dry_run - assert not job_config.use_query_cache diff --git a/tests/unit/test_catalog_functions.py b/tests/unit/test_catalog_functions.py index a17e9cf8..6613ae57 100644 --- a/tests/unit/test_catalog_functions.py +++ b/tests/unit/test_catalog_functions.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/unit/test_comments.py b/tests/unit/test_comments.py index 280ce989..c0657f0d 100644 --- a/tests/unit/test_comments.py +++ b/tests/unit/test_comments.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/unit/test_compiler.py b/tests/unit/test_compiler.py index f4114022..88030b47 100644 --- a/tests/unit/test_compiler.py +++ b/tests/unit/test_compiler.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/unit/test_compliance.py b/tests/unit/test_compliance.py index cbf40cfc..7cae1825 100644 --- a/tests/unit/test_compliance.py +++ b/tests/unit/test_compliance.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/unit/test_dialect_types.py b/tests/unit/test_dialect_types.py index 58537e19..a1af7c47 100644 --- a/tests/unit/test_dialect_types.py +++ b/tests/unit/test_dialect_types.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -23,7 +23,8 @@ # https://docs.sqlalchemy.org/en/13/core/type_basics.html#vendor-specific-types def test_types_import(): """Demonstrate behavior of importing types independent of any other import.""" - dialect_module = importlib.import_module("pybigquery.sqlalchemy_bigquery") - custom_types = getattr(dialect_module, "_type_map") + dialect_module = importlib.import_module("sqlalchemy_bigquery") + base_module = importlib.import_module("sqlalchemy_bigquery.base") + custom_types = getattr(base_module, "_type_map") for type_name, type_value in custom_types.items(): assert getattr(dialect_module, type_name) == type_value diff --git a/tests/unit/test_engine.py b/tests/unit/test_engine.py index 8d8d75b9..59481baa 100644 --- a/tests/unit/test_engine.py +++ b/tests/unit/test_engine.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in diff --git a/tests/unit/test_helpers.py b/tests/unit/test_helpers.py index 2166284f..53f92080 100644 --- a/tests/unit/test_helpers.py +++ b/tests/unit/test_helpers.py @@ -1,4 +1,4 @@ -# Copyright 2021 The PyBigQuery Authors +# Copyright 2021 The sqlalchemy-bigquery Authors # # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at @@ -25,7 +25,7 @@ def with_scopes(self, scopes): @pytest.fixture(scope="session") def module_under_test(): - from pybigquery import _helpers + from sqlalchemy_bigquery import _helpers return _helpers diff --git a/tests/unit/test_like_reescape.py b/tests/unit/test_like_reescape.py index 2c9bf304..ec21b340 100644 --- a/tests/unit/test_like_reescape.py +++ b/tests/unit/test_like_reescape.py @@ -20,14 +20,14 @@ import sqlalchemy.sql.operators import sqlalchemy.sql.schema -import pybigquery.sqlalchemy_bigquery +import sqlalchemy_bigquery.base def _check(raw, escaped, escape=None, autoescape=True): col = sqlalchemy.sql.schema.Column() op = col.contains(raw, escape=escape, autoescape=autoescape) - o2 = pybigquery.sqlalchemy_bigquery.BigQueryCompiler._maybe_reescape(op) + o2 = sqlalchemy_bigquery.base.BigQueryCompiler._maybe_reescape(op) assert o2.left.__dict__ == op.left.__dict__ assert not o2.modifiers.get("escape") diff --git a/tests/unit/test_parse_url.py b/tests/unit/test_parse_url.py index a3b5c2fb..b66790c0 100644 --- a/tests/unit/test_parse_url.py +++ b/tests/unit/test_parse_url.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 The PyBigQuery Authors +# Copyright (c) 2017 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -23,7 +23,7 @@ from google.cloud.bigquery.table import EncryptionConfiguration, TableReference from google.cloud.bigquery.dataset import DatasetReference -from pybigquery.parse_url import parse_url +from sqlalchemy_bigquery.parse_url import parse_url @pytest.fixture(scope="session") @@ -249,7 +249,7 @@ def test_not_implemented(not_implemented_arg): def test_parse_boolean(): - from pybigquery.parse_url import parse_boolean + from sqlalchemy_bigquery.parse_url import parse_boolean assert parse_boolean("true") assert parse_boolean("True") diff --git a/tests/unit/test_select.py b/tests/unit/test_select.py index db2e68c8..5d49ae68 100644 --- a/tests/unit/test_select.py +++ b/tests/unit/test_select.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -23,7 +23,7 @@ import pytest import sqlalchemy -import pybigquery.sqlalchemy_bigquery +import sqlalchemy_bigquery from conftest import ( setup_table, @@ -141,7 +141,7 @@ def test_typed_parameters(faux_conn, type_, val, btype, vrep): table.insert() .values(**{col_name: sqlalchemy.literal(val, type_)}) .compile( - dialect=pybigquery.sqlalchemy_bigquery.BigQueryDialect(), + dialect=sqlalchemy_bigquery.BigQueryDialect(), compile_kwargs=dict(literal_binds=True), ) ) diff --git a/tests/unit/test_sqlalchemy_bigquery.py b/tests/unit/test_sqlalchemy_bigquery.py index 2cad9c82..78b5b3cd 100644 --- a/tests/unit/test_sqlalchemy_bigquery.py +++ b/tests/unit/test_sqlalchemy_bigquery.py @@ -1,4 +1,4 @@ -# Copyright 2021 The PyBigQuery Authors +# Copyright 2021 The sqlalchemy-bigquery Authors # # Use of this source code is governed by an MIT-style # license that can be found in the LICENSE file or at @@ -21,7 +21,7 @@ def mock_bigquery_client(): @pytest.fixture def mock_connection(monkeypatch, mock_bigquery_client): - from pybigquery import sqlalchemy_bigquery + import sqlalchemy_bigquery def mock_connect_args(*args, **kwargs): return ([mock_bigquery_client], {}) @@ -154,7 +154,7 @@ def test_get_view_names( ], ) def test__remove_type_from_empty_in(inp, outp): - from pybigquery.sqlalchemy_bigquery import BigQueryExecutionContext + from sqlalchemy_bigquery.base import BigQueryExecutionContext r = BigQueryExecutionContext._BigQueryExecutionContext__remove_type_from_empty_in assert r(None, inp) == outp diff --git a/tests/unit/test_view.py b/tests/unit/test_view.py index 0ea943bc..8c1b560c 100644 --- a/tests/unit/test_view.py +++ b/tests/unit/test_view.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 The PyBigQuery Authors +# Copyright (c) 2021 The sqlalchemy-bigquery Authors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in