Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: sync v3 branch with main #996

Merged
merged 90 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
3b70891
chore: protect v3.x.x branch (#816)
tswast Jul 27, 2021
3c1be14
fix: no longer raise a warning in `to_dataframe` if `max_results` set…
plamut Jul 27, 2021
fe7a902
feat: Update proto definitions for bigquery/v2 to support new proto f…
gcf-owl-bot[bot] Jul 27, 2021
02bbdae
chore: release 2.23.0 (#819)
release-please[bot] Jul 27, 2021
42b66d3
chore(deps): update dependency google-cloud-bigquery to v2.23.0 (#820)
renovate-bot Jul 28, 2021
d9378af
fix: `insert_rows()` accepts float column values as strings again (#824)
plamut Jul 28, 2021
a505440
chore: release 2.23.1 (#825)
release-please[bot] Jul 28, 2021
c541c69
chore: add second protection rule for v3 branch (#828)
tswast Jul 28, 2021
48e8a35
chore(deps): update dependency google-cloud-bigquery to v2.23.1 (#827)
renovate-bot Jul 28, 2021
d8c25ac
test: retry getting rows after streaming them in `test_insert_rows_fr…
tswast Jul 29, 2021
8149d9e
chore(deps): update dependency pyarrow to v5 (#834)
renovate-bot Jul 29, 2021
b9349ad
chore(deps): update dependency google-cloud-bigquery-storage to v2.6.…
renovate-bot Jul 29, 2021
80e3a61
deps: expand pyarrow pins to support 5.x releases (#833)
plamut Jul 29, 2021
40ef77f
chore: release 2.23.2 (#835)
release-please[bot] Jul 29, 2021
55687b8
chore(deps): update dependency google-auth-oauthlib to v0.4.5 (#839)
renovate-bot Jul 29, 2021
85ce81c
chore(deps): update dependency google-cloud-bigquery to v2.23.2 (#838)
renovate-bot Jul 29, 2021
20df24b
chore(deps): update dependency google-cloud-testutils to v1 (#845)
renovate-bot Aug 3, 2021
7016f69
chore: require CODEOWNER review and up to date branches (#846)
busunkim96 Aug 3, 2021
cf0b0d8
chore: add api-bigquery as a samples owner (#852)
busunkim96 Aug 5, 2021
30770fd
fix: increase default retry deadline to 10 minutes (#859)
tswast Aug 6, 2021
e2cbcaa
process: add yoshi-python to samples CODEOWNERS (#858)
plamut Aug 6, 2021
9694a4d
chore: release 2.23.3 (#860)
release-please[bot] Aug 9, 2021
9c6614f
chore(deps): update dependency google-cloud-bigquery to v2.23.3 (#866)
renovate-bot Aug 9, 2021
7f7b1a8
feat: add support for transaction statistics (#849)
plamut Aug 10, 2021
443b8ab
chore(deps): update dependency google-cloud-bigquery-storage to v2.6.…
renovate-bot Aug 10, 2021
aee814c
chore: fix INSTALL_LIBRARY_FROM_SOURCE in noxfile.py (#869)
gcf-owl-bot[bot] Aug 11, 2021
c1a3d44
feat: make the same `Table*` instances equal to each other (#867)
plamut Aug 11, 2021
93d15e2
feat: support `ScalarQueryParameterType` for `type_` argument in `Sca…
tswast Aug 11, 2021
519d99c
feat: retry failed query jobs in `result()` (#837)
jimfulton Aug 11, 2021
ad9c802
fix: make unicode characters working well in load_table_from_json (#865)
grimmer0125 Aug 11, 2021
cf6f0e9
chore: release 2.24.0 (#868)
release-please[bot] Aug 11, 2021
c44d45b
chore(deps): update dependency google-cloud-bigquery to v2.24.0 (#873)
renovate-bot Aug 12, 2021
e3704c3
test: refactor `list_rows` tests and add test for scalars (#829)
tswast Aug 13, 2021
cd21df1
chore: drop mention of Python 2.7 from templates (#877)
gcf-owl-bot[bot] Aug 13, 2021
2cb3563
fix: remove pytz dependency and require pyarrow>=3.0.0 (#875)
busunkim96 Aug 13, 2021
936660b
chore: release 2.24.1 (#879)
release-please[bot] Aug 19, 2021
5c5b4b8
chore(deps): update dependency google-cloud-bigquery to v2.24.1 (#887)
renovate-bot Aug 19, 2021
16f65e6
feat: Support using GeoPandas for GEOGRAPHY columns (#848)
jimfulton Aug 24, 2021
aa4876e
test: Add test of datetime and time pandas load (#895)
jimfulton Aug 24, 2021
f319d25
chore: release 2.25.0 (#898)
release-please[bot] Aug 24, 2021
fbbf72c
chore(deps): update dependency numpy to v1.21.2 (#899)
renovate-bot Aug 25, 2021
72a52f0
chore(deps): update dependency google-cloud-core to v2 (#904)
renovate-bot Aug 25, 2021
1cb3e55
fix: use REST API in cell magic when requested (#892)
plamut Aug 25, 2021
b508809
fix: populate default `timeout` and retry after client-side timeout (…
tswast Aug 25, 2021
4fc7c69
chore(deps): update dependency google-cloud-bigquery to v2.25.0 (#907)
renovate-bot Aug 25, 2021
121c2c2
chore(deps): update dependency pandas to v1.3.2 (#900)
renovate-bot Aug 25, 2021
a3a85da
chore: group all renovate PRs together (#911)
tswast Aug 25, 2021
109a536
chore: release 2.25.1 (#912)
release-please[bot] Aug 25, 2021
e2d12b7
docs: update docstring for bigquery_create_routine sample (#883) (#917)
plamut Aug 26, 2021
679e8ed
chore: migrate default branch to main (#910)
plamut Aug 26, 2021
4f229cb
chore: invalid docstrings broke docfx (#924)
jimfulton Aug 27, 2021
8448922
chore(deps): update all dependencies (#914)
renovate-bot Aug 30, 2021
656d2fa
fix: error inserting DataFrame with REPEATED field (#925)
plamut Aug 31, 2021
bd417d3
chore(deps): update all dependencies (#926)
renovate-bot Aug 31, 2021
fcb0bc6
fix: underscores weren't allowed in struct field names when passing p…
jimfulton Aug 31, 2021
936686b
chore: release 2.25.2 (#916)
release-please[bot] Sep 1, 2021
10fee52
chore(deps): update all dependencies (#928)
renovate-bot Sep 1, 2021
b289076
fix: guard imports against unsupported pyarrow versions (#934)
tswast Sep 1, 2021
ba02f24
feat: set the X-Server-Timeout header when timeout is set (#927)
jimfulton Sep 1, 2021
db57c1c
chore: release 2.26.0 (#937)
release-please[bot] Sep 1, 2021
65cb29d
chore(deps): update dependency google-cloud-bigquery to v2.26.0 (#938)
renovate-bot Sep 2, 2021
1c2bd01
chore: update system tests and samples to use and @google.com email a…
jimfulton Sep 2, 2021
c29c723
chore(python): rename default branch to main (#935)
gcf-owl-bot[bot] Sep 3, 2021
503d360
chore: Reduce duplicated code betweem tests/unit and tests/unit/job (…
jimfulton Sep 3, 2021
e3b26d8
test: fix routine DDL sample test exits too early (#932)
plamut Sep 3, 2021
c9068e4
chore(deps): update all dependencies (#939)
renovate-bot Sep 3, 2021
1a6ab12
tests: add more dependencies to pre-release tests (#948)
plamut Sep 7, 2021
864383b
fix: Arrow extension-type metadata was not set when calling the REST …
jimfulton Sep 7, 2021
76c0616
chore: reference main branch of google-cloud-python (#953)
busunkim96 Sep 7, 2021
9157537
chore(deps): update all dependencies (#943)
renovate-bot Sep 10, 2021
acca1cb
feat: include key metadata in Job representation (#964)
plamut Sep 13, 2021
4f72359
test: ensure prerelease versions of pandas and arrow are tested night…
tswast Sep 14, 2021
ab6e76f
docs: simplify destination table sample with f-strings (#966)
tswast Sep 14, 2021
6e785c7
cleanup: get rid of unit test warnings caused by our code (#973)
plamut Sep 17, 2021
afdc1ed
refactor: extract common logic to TableBase class (#956)
plamut Sep 17, 2021
96e6bee
feat: Add py.typed for PEP 561 compliance (#976)
jdufresne Sep 20, 2021
1cef0d4
fix: remove default timeout (#974)
tswast Sep 21, 2021
fcd6336
test: look for transaction info on child job, not parent job (#978)
tswast Sep 21, 2021
ee1e25c
chore: relocate owl bot post processor (#979)
SurferJeffAtGoogle Sep 21, 2021
f83c00a
fix: disambiguate missing policy tags from explicitly unset policy ta…
tswast Sep 24, 2021
71cc728
chore: release 2.27.0 (#965)
release-please[bot] Sep 27, 2021
39030f2
fix: remove py.typed since package fails mypy check (#988)
tswast Sep 27, 2021
3e32c1a
chore: release 2.27.1 (#989)
release-please[bot] Sep 27, 2021
ea50e80
docs: link to stable pandas docs (#990)
tswast Sep 28, 2021
2ca58dc
chore: exclude 'CODEOWNERS' from templated files (#986)
tseaver Sep 28, 2021
a789d00
chore(deps): update all dependencies (#963)
renovate-bot Sep 28, 2021
b200c40
Merge branch 'main' into sync-with-main
plamut Sep 30, 2021
19e9812
Fix coverage (unnecessary helper in test)
plamut Sep 30, 2021
fc6f7fc
Remove unnecessary fields from TableReference
plamut Sep 30, 2021
bdacef2
Apply suggestions from code review
tswast Sep 30, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
digest: sha256:0ffe3bdd6c7159692df5f7744da74e5ef19966288a6bf76023e8e04e0c424d7d
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a
2 changes: 1 addition & 1 deletion .github/.OwlBot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest

deep-remove-regex:
- /owl-bot-staging
Expand Down
7 changes: 7 additions & 0 deletions .kokoro/continuous/prerelease-deps-3.8.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Format: //devtools/kokoro/config/proto/build.proto

# Only run this nox session.
env_vars: {
key: "NOX_SESSION"
value: "prerelease_deps"
}
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,33 @@
[1]: https://pypi.org/project/google-cloud-bigquery/#history


### [2.27.1](https://www.github.com/googleapis/python-bigquery/compare/v2.27.0...v2.27.1) (2021-09-27)


### Bug Fixes

* remove py.typed since package fails mypy check ([#988](https://www.github.com/googleapis/python-bigquery/issues/988)) ([39030f2](https://www.github.com/googleapis/python-bigquery/commit/39030f26ce081cfacd456b84694c68e3f04ed48d))

## [2.27.0](https://www.github.com/googleapis/python-bigquery/compare/v2.26.0...v2.27.0) (2021-09-24)


### Features

* Add py.typed for PEP 561 compliance ([#976](https://www.github.com/googleapis/python-bigquery/issues/976)) ([96e6bee](https://www.github.com/googleapis/python-bigquery/commit/96e6beef3c63b663b7e5879b1458f4dd1a47a5b5))
* include key metadata in Job representation ([#964](https://www.github.com/googleapis/python-bigquery/issues/964)) ([acca1cb](https://www.github.com/googleapis/python-bigquery/commit/acca1cb7baaa3b00508246c994ade40314d421c3))


### Bug Fixes

* Arrow extension-type metadata was not set when calling the REST API or when there are no rows ([#946](https://www.github.com/googleapis/python-bigquery/issues/946)) ([864383b](https://www.github.com/googleapis/python-bigquery/commit/864383bc01636b3774f7da194587b8b7edd0383d))
* disambiguate missing policy tags from explicitly unset policy tags ([#983](https://www.github.com/googleapis/python-bigquery/issues/983)) ([f83c00a](https://www.github.com/googleapis/python-bigquery/commit/f83c00acead70fc0ce9959eefb133a672d816277))
* remove default timeout ([#974](https://www.github.com/googleapis/python-bigquery/issues/974)) ([1cef0d4](https://www.github.com/googleapis/python-bigquery/commit/1cef0d4664bf448168b26487a71795144b7f4d6b))


### Documentation

* simplify destination table sample with f-strings ([#966](https://www.github.com/googleapis/python-bigquery/issues/966)) ([ab6e76f](https://www.github.com/googleapis/python-bigquery/commit/ab6e76f9489262fd9c1876a1c4f93d7e139aa999))

## [2.26.0](https://www.github.com/googleapis/python-bigquery/compare/v2.25.2...v2.26.0) (2021-09-01)


Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ processing power of Google's infrastructure.
- `Product Documentation`_

.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
:target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#general-availability
:target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-bigquery.svg
:target: https://pypi.org/project/google-cloud-bigquery/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-bigquery.svg
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
"grpc": ("https://grpc.github.io/grpc/python/", None),
"pandas": ("http://pandas.pydata.org/pandas-docs/dev", None),
"pandas": ("http://pandas.pydata.org/pandas-docs/stable/", None),
"geopandas": ("https://geopandas.org/", None),
}

Expand Down
1 change: 1 addition & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Schema
:toctree: generated

schema.SchemaField
schema.PolicyTagList


Query
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
from google.cloud.bigquery.routine import RoutineArgument
from google.cloud.bigquery.routine import RoutineReference
from google.cloud.bigquery.routine import RoutineType
from google.cloud.bigquery.schema import PolicyTagList
from google.cloud.bigquery.schema import SchemaField
from google.cloud.bigquery.standard_sql import StandardSqlDataType
from google.cloud.bigquery.standard_sql import StandardSqlField
Expand Down Expand Up @@ -145,6 +146,7 @@
"RoutineReference",
# Shared helpers
"SchemaField",
"PolicyTagList",
"UDFResource",
"ExternalConfig",
"BigtableOptions",
Expand Down
16 changes: 12 additions & 4 deletions google/cloud/bigquery/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,9 @@ def _get_sub_prop(container, keys, default=None):
container (Dict):
A dictionary which may contain other dictionaries as values.
keys (Iterable):
A sequence of keys to attempt to get the value for. Each item in
the sequence represents a deeper nesting. The first key is for
A sequence of keys to attempt to get the value for. If ``keys`` is a
string, it is treated as sequence containing a single string key. Each item
in the sequence represents a deeper nesting. The first key is for
the top level. If there is a dictionary there, the second key
attempts to get the value within that, and so on.
default (Optional[object]):
Expand All @@ -632,6 +633,9 @@ def _get_sub_prop(container, keys, default=None):
Returns:
object: The value if present or the default.
"""
if isinstance(keys, str):
keys = [keys]

sub_val = container
for key in keys:
if key not in sub_val:
Expand All @@ -647,8 +651,9 @@ def _set_sub_prop(container, keys, value):
container (Dict):
A dictionary which may contain other dictionaries as values.
keys (Iterable):
A sequence of keys to attempt to set the value for. Each item in
the sequence represents a deeper nesting. The first key is for
A sequence of keys to attempt to set the value for. If ``keys`` is a
string, it is treated as sequence containing a single string key. Each item
in the sequence represents a deeper nesting. The first key is for
the top level. If there is a dictionary there, the second key
attempts to get the value within that, and so on.
value (object): Value to set within the container.
Expand All @@ -675,6 +680,9 @@ def _set_sub_prop(container, keys, value):
>>> container
{'key': {'subkey': 'new'}}
"""
if isinstance(keys, str):
keys = [keys]

sub_val = container
for key in keys[:-1]:
if key not in sub_val:
Expand Down
14 changes: 13 additions & 1 deletion google/cloud/bigquery/_pandas_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ def pyarrow_timestamp():
# the type ID matters, and it's the same for all decimal256 instances.
pyarrow.decimal256(76, scale=38).id: "BIGNUMERIC",
}
BQ_FIELD_TYPE_TO_ARROW_FIELD_METADATA = {
"GEOGRAPHY": {
b"ARROW:extension:name": b"google:sqlType:geography",
b"ARROW:extension:metadata": b'{"encoding": "WKT"}',
},
"DATETIME": {b"ARROW:extension:name": b"google:sqlType:datetime"},
}


def bq_to_arrow_struct_data_type(field):
Expand Down Expand Up @@ -233,7 +240,12 @@ def bq_to_arrow_field(bq_field, array_type=None):
if array_type is not None:
arrow_type = array_type # For GEOGRAPHY, at least initially
is_nullable = bq_field.mode.upper() == "NULLABLE"
return pyarrow.field(bq_field.name, arrow_type, nullable=is_nullable)
metadata = BQ_FIELD_TYPE_TO_ARROW_FIELD_METADATA.get(
bq_field.field_type.upper() if bq_field.field_type else ""
)
return pyarrow.field(
bq_field.name, arrow_type, nullable=is_nullable, metadata=metadata
)

warnings.warn("Unable to determine type for field '{}'.".format(bq_field.name))
return None
Expand Down
13 changes: 13 additions & 0 deletions google/cloud/bigquery/job/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@ def reservation_usage(self):
def transaction_info(self) -> Optional[TransactionInfo]:
"""Information of the multi-statement transaction if this job is part of one.

Since a scripting query job can execute multiple transactions, this
property is only expected on child jobs. Use the
:meth:`google.cloud.bigquery.client.Client.list_jobs` method with the
``parent_job`` parameter to iterate over child jobs.

.. versionadded:: 2.24.0
"""
info = self._properties.get("statistics", {}).get("transactionInfo")
Expand Down Expand Up @@ -722,6 +727,14 @@ def cancelled(self):
and self.error_result.get("reason") == _STOPPED_REASON
)

def __repr__(self):
result = (
f"{self.__class__.__name__}<"
f"project={self.project}, location={self.location}, id={self.job_id}"
">"
)
return result


class _JobConfig(object):
"""Abstract base class for job configuration objects.
Expand Down
14 changes: 14 additions & 0 deletions google/cloud/bigquery/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ def label_columns(self) -> Sequence[standard_sql.StandardSqlField]:
"""
return self._properties.get("labelColumns", [])

@property
def best_trial_id(self) -> Optional[int]:
"""The best trial_id across all training runs.

.. deprecated::
This property is deprecated!

Read-only.
"""
value = self._properties.get("bestTrialId")
if value is not None:
value = int(value)
return value

@property
def expires(self) -> Optional[datetime.datetime]:
"""The datetime when this model expires.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/bigquery/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def _should_retry(exc):
pass ``retry=bigquery.DEFAULT_RETRY.with_deadline(30)``.
"""

DEFAULT_TIMEOUT = 5.0 * 60.0
DEFAULT_TIMEOUT = None
"""The default API timeout.

This is the time to wait per request. To adjust the total wait time, set a
Expand Down
Loading