GoogleCloudPlatform / GoogleCloudPlatform/professional-services-data-validator
Sybase TEXT throws exception in count column validation
- Dominant language
- Python
- Stars
- 524
- Forks
- 171
- Avg merge
- 5d 15h
- Merged PRs (30d)
- 4
Description
**Describe the bug**
Sybase TEXT throws exception in count column validation:
```
sqlalchemy.exc.DataError: (pyodbc.DataError) ('22018', '[22018] [FreeTDS][SQL Server]The COUNT AGGREGATE operation cannot take a TEXT datatype as an argument.\n (409) (SQLExecDirectW)')
```
**What version of DVT are you using?**
8.4.0
**What type of connections are you using for source and target?**
Sybase
**Expected behavior**
We need to change DVT to follow the same steps as Oracle CLOB. i.e.:
1. Implement `raw_column_metadata` in `ibis_sybase/__init__.py`
2. Add an `_is_sybase_text` method to `config_manager.py`, use `is_oracle_lob` as a template
3. Add a call to `_is_sybase_text` where we use `is_oracle_lob` below:
```
if all(
_ in ["string", "!string", "json", "!json"]
for _ in [column_type, target_column_type]
):
# These data types are aggregated using their lengths, except for count().
if agg_type == "count":
# Oracle LOBs and Sybase TEXT need a length() before the count().
return (self._is_oracle_lob(source_column, target_column) or self._is_sybase_lob(source_column, target_column))
else:
return True
```
Search for "issue-1675" in the repo when working on this issue.
Contributor guide
Assessment
This issue has not been assessed yet.