singer_sdk.connectors.sql.SQLToJSONSchema¶
- class singer_sdk.connectors.sql.SQLToJSONSchema[source]¶
SQLAlchemy to JSON Schema type mapping helper.
This class provides a mapping from SQLAlchemy types to JSON Schema types.
Added in version 0.41.0.
Changed in version 0.43.0: Added the
singer_sdk.connectors.sql.SQLToJSONSchema.from_config()
class method.Changed in version 0.45.0: Added support for the use_singer_decimal option.
- classmethod from_config(config)[source]¶
Create a new instance from a configuration dictionary.
Override this to instantiate this converter with values from the tap’s configuration dictionary.
class CustomSQLToJSONSchema(SQLToJSONSchema): def __init__(self, *, my_custom_option, **kwargs): super().__init__(**kwargs) self.my_custom_option = my_custom_option @classmethod def from_config(cls, config): return cls(my_custom_option=config.get("my_custom_option"))
- Parameters:
config (dict) – The configuration dictionary.
use_singer_decimal – Whether to represent numbers as string with the x-singer.decimal format instead of as number.
- Returns:
A new instance of the class.
- Return type:
- __init__(*, use_singer_decimal=False)[source]¶
Initialize the SQL to JSON Schema converter.
- Parameters:
use_singer_decimal (bool) – Whether to represent numbers as string with the x-singer.decimal format instead of as number.
- Return type:
None
- datetime_to_jsonschema(column_type)[source]¶
Return a JSON Schema representation of a generic datetime type.
- float_to_jsonschema(column_type)[source]¶
Return a JSON Schema representation of a generic number type.
- integer_to_jsonschema(column_type)[source]¶
Return a JSON Schema representation of a an integer type.