PyTd icon indicating copy to clipboard operation
PyTd copied to clipboard

teradata.tdrest trims trailing spaces (too)

Open padhia opened this issue 9 years ago • 0 comments

This is probably related to #49. When that is fixed, hopefully this one will be fixed as well -- but just wanted to put his one out for tracking.

import teradata

with teradata.tdrest.connect(host='localhost', system='mytd', username='dbc', password='******') as conn:
    with conn.cursor() as csr:
        csr.execute("select cast('1 ' as CHAR(2)) as col, type(col) as col_type, length(col) as col_len")
        col, col_type, col_len = csr.fetchone()
        print('Column: Value={}, Type={}, DB Len={}, Python Len={}'.format(col, col_type, col_len, len(col)))

Output of the above example shows Python length is 1 when using teradata.tdrest, but it's 2 when using teradata.tdodbc.

padhia avatar Sep 01 '16 19:09 padhia