byte_encoding - Teradata Python Package

Teradata® Python Package User Guide

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-29
dita:mapPath
rkb1531260709148.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
B700-4006
lifecycle
previous
Product Category
Teradata Vantage
The byte_encoding controls the encoding used for printing byte-like types in a DataFrame. The default is Base16. The following encodings are supported:
  • BaseX

    X is a power of 2 (for example, 2, 8, 16).

  • BaseY

    Y is not a power of 2 (for example, 10 and 36).

  • Base64M (MIME)
  • ASCII
The from_bytes function is used to display byte-like types. See Teradata Vantage™ - SQL Functions, Expressions, and Predicates for more information on specifying arguments for FROM_BYTES.

Example: Default is Base16

>>> display.byte_encoding
'base16'
 
 
>>> DataFrame('byte')
 
 
           byte      varbyte         blob
id                                      
2   b'32616263'  b'32616263'  b'32616263'
1   b'31616263'  b'31616263'  b'31616263'
0   b'30616263'  b'30616263'  b'30616263'

Example: Set the value to ascii

>>> display.byte_encoding = 'ascii'
>>> DataFrame('byte')
 
 
       byte  varbyte     blob
id                          
2   b'2abc'  b'2abc'  b'2abc'
1   b'1abc'  b'1abc'  b'1abc'
0   b'0abc'  b'0abc'  b'0abc'