diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 2567653..7d98291 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:87eee22d276554e4e52863ec9b1cb6a7245815dfae20439712bf644348215a5a + digest: sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg index 41b24a6..00e5745 100644 --- a/.kokoro/samples/lint/common.cfg +++ b/.kokoro/samples/lint/common.cfg @@ -31,4 +31,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-logging/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-logging/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.10/common.cfg b/.kokoro/samples/python3.10/common.cfg new file mode 100644 index 0000000..e1de5d4 --- /dev/null +++ b/.kokoro/samples/python3.10/common.cfg @@ -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.10" +} + +# Declare build specific Cloud project. +env_vars: { + key: "BUILD_SPECIFIC_GCLOUD_PROJECT" + value: "python-docs-samples-tests-310" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-bigquery-logging/.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-logging/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.10/continuous.cfg b/.kokoro/samples/python3.10/continuous.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.10/continuous.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.10/periodic-head.cfg b/.kokoro/samples/python3.10/periodic-head.cfg new file mode 100644 index 0000000..da0f5fa --- /dev/null +++ b/.kokoro/samples/python3.10/periodic-head.cfg @@ -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-logging/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.10/periodic.cfg b/.kokoro/samples/python3.10/periodic.cfg new file mode 100644 index 0000000..71cd1e5 --- /dev/null +++ b/.kokoro/samples/python3.10/periodic.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "False" +} diff --git a/.kokoro/samples/python3.10/presubmit.cfg b/.kokoro/samples/python3.10/presubmit.cfg new file mode 100644 index 0000000..a1c8d97 --- /dev/null +++ b/.kokoro/samples/python3.10/presubmit.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} \ No newline at end of file diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.6/common.cfg index f5da6aa..be61bdd 100644 --- a/.kokoro/samples/python3.6/common.cfg +++ b/.kokoro/samples/python3.6/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-logging/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-logging/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.6/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.6/periodic.cfg +++ b/.kokoro/samples/python3.6/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg index f298b94..bae163f 100644 --- a/.kokoro/samples/python3.7/common.cfg +++ b/.kokoro/samples/python3.7/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-logging/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-logging/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.7/periodic.cfg +++ b/.kokoro/samples/python3.7/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg index 1183463..34ed410 100644 --- a/.kokoro/samples/python3.8/common.cfg +++ b/.kokoro/samples/python3.8/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-logging/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-logging/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.8/periodic.cfg +++ b/.kokoro/samples/python3.8/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg index 8000d03..ee14f5d 100644 --- a/.kokoro/samples/python3.9/common.cfg +++ b/.kokoro/samples/python3.9/common.cfg @@ -37,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples" gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" # Use the trampoline script to run in docker. -build_file: "python-bigquery-logging/.kokoro/trampoline.sh" \ No newline at end of file +build_file: "python-bigquery-logging/.kokoro/trampoline_v2.sh" \ No newline at end of file diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg index 50fec96..71cd1e5 100644 --- a/.kokoro/samples/python3.9/periodic.cfg +++ b/.kokoro/samples/python3.9/periodic.cfg @@ -3,4 +3,4 @@ env_vars: { key: "INSTALL_LIBRARY_FROM_SOURCE" value: "False" -} \ No newline at end of file +} diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh index 45696f8..ba3a707 100755 --- a/.kokoro/test-samples-against-head.sh +++ b/.kokoro/test-samples-against-head.sh @@ -23,6 +23,4 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-bigquery-logging - exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index f6c0792..11c042d 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -24,8 +24,6 @@ set -eo pipefail # Enables `**` to include files nested inside sub-folders shopt -s globstar -cd github/python-bigquery-logging - # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then # preserving the test runner implementation. diff --git a/.repo-metadata.json b/.repo-metadata.json index e0ed556..ed0d605 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -6,8 +6,10 @@ "issue_tracker": "https://github.com/googleapis/python-bigquerylogging/issues", "release_level": "beta", "language": "python", - "library_type" : "OTHER", + "library_type": "OTHER", "repo": "googleapis/python-bigquery-logging", "distribution_name": "google-cloud-bigquery-logging", - "api_id": "" - } + "api_id": "", + "default_version": "v1", + "codeowner_team": "@googleapis/api-bigquery" +} diff --git a/.trampolinerc b/.trampolinerc index 383b6ec..0eee72a 100644 --- a/.trampolinerc +++ b/.trampolinerc @@ -16,15 +16,26 @@ # Add required env vars here. required_envvars+=( - "STAGING_BUCKET" - "V2_STAGING_BUCKET" ) # Add env vars which are passed down into the container here. pass_down_envvars+=( + "NOX_SESSION" + ############### + # Docs builds + ############### "STAGING_BUCKET" "V2_STAGING_BUCKET" - "NOX_SESSION" + ################## + # Samples builds + ################## + "INSTALL_LIBRARY_FROM_SOURCE" + "RUN_TESTS_SESSION" + "BUILD_SPECIFIC_GCLOUD_PROJECT" + # Target directories. + "RUN_TESTS_DIRS" + # The nox session to run. + "RUN_TESTS_SESSION" ) # Prevent unintentional override on the default image. diff --git a/CHANGELOG.md b/CHANGELOG.md index 84d60d5..608c655 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.3.0](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.2.2...v0.3.0) (2021-10-08) + + +### Features + +* add context manager support in client ([#43](https://www.github.com/googleapis/python-bigquery-logging/issues/43)) ([493010c](https://www.github.com/googleapis/python-bigquery-logging/commit/493010cbfb288a75a58761d5281993009013e1b6)) + ### [0.2.2](https://www.github.com/googleapis/python-bigquery-logging/compare/v0.2.1...v0.2.2) (2021-09-24) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 54478a4..2f1e2a0 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -22,7 +22,7 @@ In order to add a feature: documentation. - The feature must work fully on the following CPython versions: - 3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows. + 3.6, 3.7, 3.8, 3.9 and 3.10 on both UNIX and Windows. - The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, but new dependencies should @@ -72,7 +72,7 @@ We use `nox `__ to instrument our tests. - To run a single unit test:: - $ nox -s unit-3.9 -- -k + $ nox -s unit-3.10 -- -k .. note:: @@ -225,11 +225,13 @@ We support: - `Python 3.7`_ - `Python 3.8`_ - `Python 3.9`_ +- `Python 3.10`_ .. _Python 3.6: https://docs.python.org/3.6/ .. _Python 3.7: https://docs.python.org/3.7/ .. _Python 3.8: https://docs.python.org/3.8/ .. _Python 3.9: https://docs.python.org/3.9/ +.. _Python 3.10: https://docs.python.org/3.10/ Supported versions can be found in our ``noxfile.py`` `config`_. diff --git a/google/cloud/bigquery_logging_v1/types/audit_data.py b/google/cloud/bigquery_logging_v1/types/audit_data.py index ea475b7..a6efed7 100644 --- a/google/cloud/bigquery_logging_v1/types/audit_data.py +++ b/google/cloud/bigquery_logging_v1/types/audit_data.py @@ -189,6 +189,7 @@ class AuditData(proto.Message): class TableInsertRequest(proto.Message): r"""Table insert request. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Table): The new table. @@ -199,6 +200,7 @@ class TableInsertRequest(proto.Message): class TableUpdateRequest(proto.Message): r"""Table update request. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Table): The table to be updated. @@ -209,6 +211,7 @@ class TableUpdateRequest(proto.Message): class TableInsertResponse(proto.Message): r"""Table insert response. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Table): Final state of the inserted table. @@ -219,6 +222,7 @@ class TableInsertResponse(proto.Message): class TableUpdateResponse(proto.Message): r"""Table update response. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Table): Final state of the updated table. @@ -229,6 +233,7 @@ class TableUpdateResponse(proto.Message): class DatasetListRequest(proto.Message): r"""Dataset list request. + Attributes: list_all (bool): Whether to list all datasets, including @@ -240,6 +245,7 @@ class DatasetListRequest(proto.Message): class DatasetInsertRequest(proto.Message): r"""Dataset insert request. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Dataset): The dataset to be inserted. @@ -250,6 +256,7 @@ class DatasetInsertRequest(proto.Message): class DatasetInsertResponse(proto.Message): r"""Dataset insert response. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Dataset): Final state of the inserted dataset. @@ -260,6 +267,7 @@ class DatasetInsertResponse(proto.Message): class DatasetUpdateRequest(proto.Message): r"""Dataset update request. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Dataset): The dataset to be updated. @@ -270,6 +278,7 @@ class DatasetUpdateRequest(proto.Message): class DatasetUpdateResponse(proto.Message): r"""Dataset update response. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Dataset): Final state of the updated dataset. @@ -280,6 +289,7 @@ class DatasetUpdateResponse(proto.Message): class JobInsertRequest(proto.Message): r"""Job insert request. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Job): Job insert request. @@ -290,6 +300,7 @@ class JobInsertRequest(proto.Message): class JobInsertResponse(proto.Message): r"""Job insert response. + Attributes: resource (google.cloud.bigquery_logging_v1.types.Job): Job insert response. @@ -300,6 +311,7 @@ class JobInsertResponse(proto.Message): class JobQueryRequest(proto.Message): r"""Job query request. + Attributes: query (str): The query. @@ -324,6 +336,7 @@ class JobQueryRequest(proto.Message): class JobQueryResponse(proto.Message): r"""Job query response. + Attributes: total_results (int): The total number of rows in the full query @@ -338,6 +351,7 @@ class JobQueryResponse(proto.Message): class JobGetQueryResultsRequest(proto.Message): r"""Job getQueryResults request. + Attributes: max_results (int): Maximum number of results to return. @@ -351,6 +365,7 @@ class JobGetQueryResultsRequest(proto.Message): class JobGetQueryResultsResponse(proto.Message): r"""Job getQueryResults response. + Attributes: total_results (int): Total number of results in query results. @@ -366,6 +381,7 @@ class JobGetQueryResultsResponse(proto.Message): class JobQueryDoneResponse(proto.Message): r"""Job getQueryDone response. + Attributes: job (google.cloud.bigquery_logging_v1.types.Job): The job and status information. The job completed if @@ -377,6 +393,7 @@ class JobQueryDoneResponse(proto.Message): class JobCompletedEvent(proto.Message): r"""Query job completed event. + Attributes: event_name (str): Name of the event. @@ -409,6 +426,7 @@ class TableDataReadEvent(proto.Message): class TableDataListRequest(proto.Message): r"""Table data-list request. + Attributes: start_row (int): Starting row offset. @@ -469,6 +487,7 @@ class Table(proto.Message): class TableInfo(proto.Message): r"""User-provided metadata for a table. + Attributes: friendly_name (str): A short name for the table, such @@ -488,6 +507,7 @@ class TableInfo(proto.Message): class TableViewDefinition(proto.Message): r"""Describes a virtual table defined by a SQL query. + Attributes: query (str): SQL query defining the view. @@ -531,6 +551,7 @@ class Dataset(proto.Message): class DatasetInfo(proto.Message): r"""User-provided metadata for a dataset. + Attributes: friendly_name (str): A short name for the dataset, such @@ -550,6 +571,7 @@ class DatasetInfo(proto.Message): class BigQueryAcl(proto.Message): r"""An access control list. + Attributes: entries (Sequence[google.cloud.bigquery_logging_v1.types.BigQueryAcl.Entry]): Access control entry list. @@ -557,6 +579,7 @@ class BigQueryAcl(proto.Message): class Entry(proto.Message): r"""Access control entry. + Attributes: role (str): The granted role, which can be ``READER``, ``WRITER``, or @@ -589,6 +612,7 @@ class Entry(proto.Message): class Job(proto.Message): r"""Describes a job. + Attributes: job_name (google.cloud.bigquery_logging_v1.types.JobName): Job name. @@ -631,6 +655,7 @@ class JobConfiguration(proto.Message): class Query(proto.Message): r"""Describes a query job, which executes a SQL-like query. + Attributes: query (str): The SQL query to run. @@ -766,6 +791,7 @@ class TableCopy(proto.Message): class TableDefinition(proto.Message): r"""Describes an external data source used in a query. + Attributes: name (str): Name of the table, used in queries. @@ -780,6 +806,7 @@ class TableDefinition(proto.Message): class JobStatus(proto.Message): r"""Running state of a job. + Attributes: state (str): State of a job: ``PENDING``, ``RUNNING``, or ``DONE``. @@ -801,6 +828,7 @@ class JobStatus(proto.Message): class JobStatistics(proto.Message): r"""Job statistics that may change after a job starts. + Attributes: create_time (google.protobuf.timestamp_pb2.Timestamp): Time when the job was created. @@ -849,6 +877,7 @@ class JobStatistics(proto.Message): class ReservationResourceUsage(proto.Message): r"""Job resource usage breakdown by reservation. + Attributes: name (str): Reservation name or "unreserved" for on- @@ -885,6 +914,7 @@ class ReservationResourceUsage(proto.Message): class DatasetName(proto.Message): r"""The fully-qualified name for a dataset. + Attributes: project_id (str): The project ID. @@ -898,6 +928,7 @@ class DatasetName(proto.Message): class TableName(proto.Message): r"""The fully-qualified name for a table. + Attributes: project_id (str): The project ID. @@ -914,6 +945,7 @@ class TableName(proto.Message): class JobName(proto.Message): r"""The fully-qualified name for a job. + Attributes: project_id (str): The project ID. @@ -930,6 +962,7 @@ class JobName(proto.Message): class EncryptionInfo(proto.Message): r"""Describes encryption properties for a table or a job + Attributes: kms_key_name (str): unique identifier for cloud kms key diff --git a/noxfile.py b/noxfile.py index 935a924..2bb4cf7 100644 --- a/noxfile.py +++ b/noxfile.py @@ -29,7 +29,7 @@ DEFAULT_PYTHON_VERSION = "3.8" SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] -UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() diff --git a/setup.py b/setup.py index 163b6c7..830e844 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ import os import setuptools # type: ignore -version = "0.2.2" +version = "0.3.0" package_root = os.path.abspath(os.path.dirname(__file__))