Skip to content

Commit

Permalink
Deprecate SQLConnector.get_object_names
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Dec 3, 2024
1 parent edd2d99 commit 304e206
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
22 changes: 0 additions & 22 deletions samples/sample_tap_bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
8 changes: 7 additions & 1 deletion singer_sdk/connectors/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 304e206

Please sign in to comment.