Gary K
03/11/2022, 7:29 AMnumber -> double precision
conversion that appears to be happening with the postgres connector (0.3.15 in airbyte 0.35.42-alpha)?
I've got a mysql source bigint column stored with full precision in the _airbyte_data json, but the normalization is converting it to a double and I'm losing precision 😱
(Note, I'd rather not have to do a custom normalisation (from raw) of all the connection streams manually; ie no heavy lifting on my part if possible 🏋️)Augustin Lafanechere (Airbyte)
03/11/2022, 3:28 PMelif is_number(definition["type"]):
sql_type = jinja_call("dbt_utils.type_float()")
And in dbt:
{% macro mysql__type_float() %}
float
{% endmacro %}
Augustin Lafanechere (Airbyte)
03/11/2022, 3:35 PMpublic JsonSchemaType getJsonType(MysqlType mysqlType) {
return switch (mysqlType) {
case
// TINYINT(1) is boolean, but it should have been converted to MysqlType.BOOLEAN in {@link
// getFieldType}
TINYINT, TINYINT_UNSIGNED, SMALLINT, SMALLINT_UNSIGNED, INT, INT_UNSIGNED, MEDIUMINT, MEDIUMINT_UNSIGNED, BIGINT, BIGINT_UNSIGNED, FLOAT, FLOAT_UNSIGNED, DOUBLE, DOUBLE_UNSIGNED, DECIMAL, DECIMAL_UNSIGNED -> JsonSchemaType.NUMBER;
case BOOLEAN -> JsonSchemaType.BOOLEAN;
case NULL -> JsonSchemaType.NULL;
// BIT(1) is boolean, but it should have been converted to MysqlType.BOOLEAN in {@link getFieldType}
case BIT, TINYBLOB, BLOB, MEDIUMBLOB, LONGBLOB, BINARY, VARBINARY, GEOMETRY -> JsonSchemaType.STRING_BASE_64;
default -> JsonSchemaType.STRING;
};
which results in float conversion by the normalization (code from airbyte-integrations/bases/base-normalization/normalization/transform_catalog/stream_processor.py):
elif is_number(definition["type"]):
sql_type = jinja_call("dbt_utils.type_float()")
. @Chris Duong [Airbyte] are you aware of this? @Gary K I've no workaround to suggest at the moment except the custom normalization that you don't feel like tackling 😄Chris Duong [Airbyte]
03/11/2022, 3:40 PMChris Duong [Airbyte]
03/11/2022, 3:53 PMGary K
03/15/2022, 10:54 PM