Skip to content

Custom query row validation on Db2 loses precision and scale #1706

@nj1973

Description

@nj1973

Describe the bug
Custom query row validation on Db2 loses precision and scale. In Backend._metadata we do have precision and scale in cursor.description:

(Pdb) p cursor.description
[['COL_INT64', DBAPITypeObject({'BIGINT'}), 20, 20, 19, 0, True],
 ['COL_DEC_10_2', DBAPITypeObject({'NUMERIC', 'NUM', 'DEC', 'DECIMAL'}), 12, 12, 10, 2, True],
 ['COL_DATE', DBAPITypeObject({'DATE'}), 10, 10, 10, 0, True]]

But not after _get_type has processed it:

(Pdb) p [(column[0].lower(), _get_type(column[1])) for column in cursor.description]
[('col_int64', <class 'ibis.expr.datatypes.core.Int64'>),
 ('col_dec_10_2', <class 'ibis.expr.datatypes.core.Decimal'>),
 ('col_date', <class 'ibis.expr.datatypes.core.Date'>)]

What version of DVT are you using?
8.5.1

What type of connections are you using for source and target?
Db2

Steps to reproduce the behavior
Add col_dec_10_2 to Db2 test test_custom_query_row_concat_validation_core_types_to_bigquery

Expected behavior
Expect scale to be included. On PostgreSQL this is working so perhaps review how that does it.

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