From ae86c5342dec644a7bc573b20df1f41f9c0c4a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Fri, 6 Sep 2024 12:25:59 -0600 Subject: [PATCH] refactor: Renamed `SQLConnector.type_mapping` to `SQLConnector.sql_to_jsonschema` (#2652) --- docs/guides/sql-tap.md | 2 +- singer_sdk/connectors/sql.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/guides/sql-tap.md b/docs/guides/sql-tap.md index 4609e2721..97975c611 100644 --- a/docs/guides/sql-tap.md +++ b/docs/guides/sql-tap.md @@ -49,6 +49,6 @@ Then, you need to use your custom type mapping in your connector: ```python class MyConnector(SQLConnector): @functools.cached_property - def type_mapping(self): + def sql_to_jsonschema(self): return CustomSQLToJSONSchema() ``` diff --git a/singer_sdk/connectors/sql.py b/singer_sdk/connectors/sql.py index 53ba1f8dc..697a74cb2 100644 --- a/singer_sdk/connectors/sql.py +++ b/singer_sdk/connectors/sql.py @@ -241,7 +241,7 @@ def logger(self) -> logging.Logger: return logging.getLogger("sqlconnector") @functools.cached_property - def type_mapping(self) -> SQLToJSONSchema: + def sql_to_jsonschema(self) -> SQLToJSONSchema: """Return the type mapper object. Override this method to provide a custom mapping for your SQL dialect. @@ -383,7 +383,7 @@ def to_jsonschema_type( The JSON Schema representation of the provided type. """ if isinstance(sql_type, sa.types.TypeEngine): - return self.type_mapping.to_jsonschema(sql_type) + return self.sql_to_jsonschema.to_jsonschema(sql_type) if isinstance(sql_type, str): # pragma: no cover warnings.warn(