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.

boolean_to_jsonschema(column_type)[source]

Return a JSON Schema representation of a boolean type.

Parameters:

column_type (Boolean) – The column type.

Return type:

dict

date_to_jsonschema(column_type)[source]

Return a JSON Schema representation of a date type.

Parameters:

column_type (Date) – The column type.

Return type:

dict

datetime_to_jsonschema(column_type)[source]

Return a JSON Schema representation of a generic datetime type.

Parameters:

column_type (DateTime) – The column type.

Return type:

dict

float_to_jsonschema(column_type)[source]

Return a JSON Schema representation of a generic number type.

Parameters:

column_type (Numeric) – The column type.

Return type:

dict

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.

Returns:

A new instance of the class.

Return type:

SQLToJSONSchema

integer_to_jsonschema(column_type)[source]

Return a JSON Schema representation of a an integer type.

Parameters:

column_type (Integer) – The column type.

Return type:

dict

string_to_jsonschema(column_type)[source]

Return a JSON Schema representation of a generic string type.

Parameters:

column_type (String) – The column type.

Return type:

dict

Changed in version 0.41.0: The length attribute is now used to determine the maximum length of the string type.

time_to_jsonschema(column_type)[source]

Return a JSON Schema representation of a time type.

Parameters:

column_type (Time) – The column type.

Return type:

dict