From 70a395e78e4fe2301cbf1e1d315cc475a5268d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez-Mondrag=C3=B3n?= Date: Wed, 15 Jan 2025 14:25:21 -0600 Subject: [PATCH] docs: Add example to method docstring --- singer_sdk/connectors/sql.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/singer_sdk/connectors/sql.py b/singer_sdk/connectors/sql.py index ab3abfacd..84f15746f 100644 --- a/singer_sdk/connectors/sql.py +++ b/singer_sdk/connectors/sql.py @@ -349,12 +349,17 @@ def register_sql_datatype_handler( sql_datatype: str, handler: JSONtoSQLHandler, ) -> None: - """Register a custom x-sql-datatype handler. + """Register a custom ``x-sql-datatype`` handler. Args: sql_datatype: The x-sql-datatype string. handler: Either a SQLAlchemy type class or a callable that takes a schema dict and returns a SQLAlchemy type instance. + + Example: + >>> from sqlalchemy.types import SMALLINT + >>> to_sql = JSONSchemaToSQL() + >>> to_sql.register_sql_datatype_handler("smallint", SMALLINT) """ self._sql_datatype_mapping[sql_datatype] = handler