Teradata / PyTd

A Python Module to make it easy to script powerful interactions with Teradata Database in a DevOps friendly way.
MIT License
108 stars 43 forks source link

teradata.tdrest trims trailing spaces (too) #52

Open padhia opened 8 years ago

padhia commented 8 years ago

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.