Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@
## Deprecations

* X behavior is deprecated and will be removed in X versions ([#X](https://github.com/apache/beam/issues/X)).
* Python SDK native SpannerIO (apache_beam/io/gcp/experimental/spannerio) is deprecated. Use cross-language wrapper
(apache_beam/io/gcp/spanner) instead (Python) ([#35860](https://github.com/apache/beam/issues/35860)).

## Bugfixes

Expand Down
12 changes: 8 additions & 4 deletions sdks/python/apache_beam/io/gcp/experimental/spannerio.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

"""Google Cloud Spanner IO

Experimental; no backwards-compatibility guarantees.
Deprecated; use apache_beam.io.gcp.spanner module instead.

This is an experimental module for reading and writing data from Google Cloud
Spanner. Visit: https://cloud.google.com/spanner for more details.
Expand Down Expand Up @@ -190,6 +190,7 @@
from apache_beam.transforms.display import DisplayDataItem
from apache_beam.typehints import with_input_types
from apache_beam.typehints import with_output_types
from apache_beam.utils.annotations import deprecated

# Protect against environments where spanner library is not available.
# pylint: disable=wrong-import-order, wrong-import-position, ungrouped-imports
Expand Down Expand Up @@ -356,8 +357,8 @@ def _table_metric(self, table_id, status):
labels = {
**self.base_labels,
monitoring_infos.RESOURCE_LABEL: resource,
monitoring_infos.SPANNER_TABLE_ID: table_id
}
if table_id: labels[monitoring_infos.SPANNER_TABLE_ID] = table_id
service_call_metric = ServiceCallMetric(
request_count_urn=monitoring_infos.API_REQUEST_COUNT_URN,
base_labels=labels)
Expand Down Expand Up @@ -612,8 +613,8 @@ def _table_metric(self, table_id):
labels = {
**self.base_labels,
monitoring_infos.RESOURCE_LABEL: resource,
monitoring_infos.SPANNER_TABLE_ID: table_id
}
if table_id: labels[monitoring_infos.SPANNER_TABLE_ID] = table_id
service_call_metric = ServiceCallMetric(
request_count_urn=monitoring_infos.API_REQUEST_COUNT_URN,
base_labels=labels)
Expand Down Expand Up @@ -675,6 +676,7 @@ def teardown(self):
self._snapshot.close()


@deprecated(since='2.68', current='apache_beam.io.gcp.spanner.ReadFromSpanner')
class ReadFromSpanner(PTransform):
"""
A PTransform to perform reads from cloud spanner.
Expand Down Expand Up @@ -825,6 +827,8 @@ def display_data(self):
return res


@deprecated(
since='2.68', current='apache_beam.io.gcp.spanner.WriteToSpannerSchema')
class WriteToSpanner(PTransform):
def __init__(
self,
Expand Down Expand Up @@ -1224,8 +1228,8 @@ def _register_table_metric(self, table_id):
labels = {
**self.base_labels,
monitoring_infos.RESOURCE_LABEL: resource,
monitoring_infos.SPANNER_TABLE_ID: table_id
}
if table_id: labels[monitoring_infos.SPANNER_TABLE_ID] = table_id
service_call_metric = ServiceCallMetric(
request_count_urn=monitoring_infos.API_REQUEST_COUNT_URN,
base_labels=labels)
Expand Down
4 changes: 2 additions & 2 deletions sdks/python/apache_beam/metrics/monitoring_infos.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,8 @@ def create_monitoring_info(
urn=urn, type=type_urn, labels=labels or {}, payload=payload)
except TypeError as e:
raise RuntimeError(
f'Failed to create MonitoringInfo for urn {urn} type {type} labels ' +
'{labels} and payload {payload}') from e
f'Failed to create MonitoringInfo for urn {urn} type {type_urn} '
f'labels {labels} and payload {payload}') from e


def is_counter(monitoring_info_proto):
Expand Down
Loading