From 304e2062d3128df378ff6b9a250b866acc84630f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Tue, 3 Dec 2024 16:44:49 -0600 Subject: [PATCH] Deprecate `SQLConnector.get_object_names` --- samples/sample_tap_bigquery/__init__.py | 22 ---------------------- singer_sdk/connectors/sql.py | 8 +++++++- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/samples/sample_tap_bigquery/__init__.py b/samples/sample_tap_bigquery/__init__.py index ad0d3c3cb..a91f372eb 100644 --- a/samples/sample_tap_bigquery/__init__.py +++ b/samples/sample_tap_bigquery/__init__.py @@ -13,28 +13,6 @@ def get_sqlalchemy_url(self, config: dict) -> str: # noqa: PLR6301 """Concatenate a SQLAlchemy URL for use in connecting to the source.""" return f"bigquery://{config['project_id']}" - def get_object_names( - self, - engine, - inspected, - schema_name: str, - ) -> list[tuple[str, bool]]: - """Return discoverable object names.""" - # Bigquery inspections returns table names in the form - # `schema_name.table_name` which later results in the project name - # override due to specifics in behavior of sqlalchemy-bigquery - # - # Let's strip `schema_name` prefix on the inspection - - return [ - (table_name.split(".")[-1], is_view) - for (table_name, is_view) in super().get_object_names( - engine, - inspected, - schema_name, - ) - ] - class BigQueryStream(SQLStream): """Stream class for BigQuery streams.""" diff --git a/singer_sdk/connectors/sql.py b/singer_sdk/connectors/sql.py index 6b3c3788e..3302a249f 100644 --- a/singer_sdk/connectors/sql.py +++ b/singer_sdk/connectors/sql.py @@ -18,6 +18,7 @@ from singer_sdk import typing as th from singer_sdk._singerlib import CatalogEntry, MetadataMapping, Schema from singer_sdk.exceptions import ConfigValidationError +from singer_sdk.helpers._compat import SingerSDKDeprecationWarning from singer_sdk.helpers._util import dump_json, load_json from singer_sdk.helpers.capabilities import TargetLoadMethods @@ -848,7 +849,12 @@ def get_schema_names( # noqa: PLR6301 """ return inspected.get_schema_names() - def get_object_names( + @deprecated( + "This method is deprecated.", + category=SingerSDKDeprecationWarning, + stacklevel=1, + ) + def get_object_names( # pragma: no cover self, engine: Engine, # noqa: ARG002 inspected: Inspector,