Skip to content

Sybase TEXT throws exception in count column validation #1675

@nj1973

Description

@nj1973

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions