OpenMetadata Profiler Crashes on MSSQL VARCHAR Columns During Data Profiling – Invalid Cast to SMALLINT
Profiler fails entire table when applying numeric metrics to varchar columns with valid string data
Affected module
Ingestion Framework – Profiler Agent (data profiling execution)
Describe the bug
When executing the Profiler Agent on a MSSQL view, the profiling fails entirely if a column defined as varchar contains normal string values (e.g., 'SSN') and the profiler attempts to apply numeric-based metrics.
The view and column are correctly typed as varchar(255), and the value 'SSN' is valid and expected. There is no inconsistency in the database schema.
Yet, the profiler raises the following error repeatedly:
(pytds.tds_base.OperationalError) Conversion failed when converting the varchar value 'SSN' to data type smallint.
This indicates the profiler is improperly casting varchar to numeric types internally, which results in aborting the profiling of the entire table — even when other columns are fully valid.
To Reproduce
Steps:
- Create a view in MSSQL that includes a
varchar(255)column containing text values like'SSN'. - Configure a profiler ingestion pipeline in OpenMetadata.
- Set
includeViews: trueand allow default metric inference. - Run the profiler and observe the failure.
Log snippet:
(pytds.tds_base.OperationalError) Conversion failed when converting the varchar value 'SSN' to data type smallint.
Screenshots: (attached)
Expected behavior
We expect OpenMetadata Profiler to:
- Automatically skip numeric metrics (
min,max,stddev,quantile, etc.) for non-numeric columns likevarchar. - Not apply casts that violate the column's declared SQL type.
- Profile the rest of the table even if one column fails.
This behavior is critical for environments that use views with mixed data types.
Technical Context
This is not a database issue. The view was verified by the DBA. All columns involved are explicitly defined as varchar(255), and no implicit casting exists.
Therefore, this profiling error should not happen. The system should recognize the column's data type and skip incompatible metrics instead of applying numeric profiling logic to a varchar.
This is a blocker for using the profiler safely on real-world datasets.
Version Information
- OS: Ubuntu 22.04 (Dockerized environment)
- Python version: 3.10
- OpenMetadata version: 1.7.0
- OpenMetadata Ingestion package:
openmetadata-ingestion[docker]==1.7.0.0
Additional context
A temporary workaround is to manually exclude the problematic column using excludeColumns or restrict the metrics to safe ones like:
metrics:
- count
- nullCount
- nonNullCount
- distinctCount
However, that approach doesn't scale for large environments. The system should be robust enough to handle column type inference without crashing the entire profiling process.
This needs to be fixed in the ingestion framework's handling of metric-type inference and application logic.
@filipimr thank you for your research on this, would you be interested in contributing the fix? Also if you can share evidence of the entire profiler failing and not computing the rest of the metrics we would appreciate it.
@filipimr I am unable to reproduce this error in 1.9.x -- see attached. Can you confirm you are using MSSQL and not AzureSQL. Can you confirm if you are still seeing the issue in the latest version?
Closing this as not answer in the last 30 days