When use_type_guessing = true and strict_type_guessing = false, the type_guess function in utils.py still classifies columns containing mixed values (e.g. "1213", "0164A") as numeric, causing a PostgreSQL error during COPY/insert:
invalid input syntax for type numeric: "0164A"
Root cause:
The Stream object pre-converts cell values via tabulator before type_guess is called. Numeric-looking values like "1213" become Decimal('1213'), while non-numeric values like "0164A" remain as str.
In type_guess (with strict=False), the logic counts isinstance(cell, type) votes. Since 850+ cells are already Decimal objects and only 2-3 remain as str, Decimal wins the vote — even though the column contains non-numeric data.
The strict=False parameter is supposed to mean "if any value doesn't match, don't use that type", but it doesn't work as expected because:
The pre-conversion already turned most values into Decimal
isinstance(Decimal('1213'), str) is False, so str gets almost no votes
The few remaining str values (like "0164A") are outvoted
Additionally: _save_type_overrides then persists type_override: numeric in the datastore metadata, making the problem permanent even on subsequent reloads.
Steps to reproduce:
Set ckanext.xloader.use_type_guessing = true and ckanext.xloader.strict_type_guessing = false i try to change this but also doesnt work
Upload a CSV where a column has mostly numeric values but a one alphanumeric ones (e.g. flight numbers: 1213, 1549, 0164A)
xloader will fail with invalid input syntax for type numeric
Environment:
CKAN 2.10.3
ckanext-xloader (latest from pip)
tabulator library with sample_size=1000
do you have a issue for this i write something but i prefer ti know what about this
When use_type_guessing = true and strict_type_guessing = false, the type_guess function in utils.py still classifies columns containing mixed values (e.g. "1213", "0164A") as numeric, causing a PostgreSQL error during COPY/insert:
invalid input syntax for type numeric: "0164A"
Root cause:
The Stream object pre-converts cell values via tabulator before type_guess is called. Numeric-looking values like "1213" become Decimal('1213'), while non-numeric values like "0164A" remain as str.
In type_guess (with strict=False), the logic counts isinstance(cell, type) votes. Since 850+ cells are already Decimal objects and only 2-3 remain as str, Decimal wins the vote — even though the column contains non-numeric data.
The strict=False parameter is supposed to mean "if any value doesn't match, don't use that type", but it doesn't work as expected because:
The pre-conversion already turned most values into Decimal
isinstance(Decimal('1213'), str) is False, so str gets almost no votes
The few remaining str values (like "0164A") are outvoted
Additionally: _save_type_overrides then persists type_override: numeric in the datastore metadata, making the problem permanent even on subsequent reloads.
Steps to reproduce:
Set ckanext.xloader.use_type_guessing = true and ckanext.xloader.strict_type_guessing = false i try to change this but also doesnt work
Upload a CSV where a column has mostly numeric values but a one alphanumeric ones (e.g. flight numbers: 1213, 1549, 0164A)
xloader will fail with invalid input syntax for type numeric
Environment:
CKAN 2.10.3
ckanext-xloader (latest from pip)
tabulator library with sample_size=1000
do you have a issue for this i write something but i prefer ti know what about this