Loading...

verticapy.vertica_python_dtype#

verticapy.vertica_python_dtype(type_name: str, display_size: int = 0, precision: int = 0, scale: int = 0) str#

Takes as input the Vertica Python type code and returns its corresponding data type.

Parameters#

type_name: str

Type Name.

display_size: int, optional

Display Size.

precision: int, optional

Type Precision.

scale: int, optional

Scale.

Returns#

str

The final type.

Examples#

Let’s import the function before proceeding.

from verticapy.sql import vertica_python_dtype

Let’s format a varchar data type.

vertica_python_dtype('varchar', 666)
Out[2]: 'varchar(666)'

Let’s format a numeric data type.

vertica_python_dtype('numeric', precision = 5, scale = 4)
Out[3]: 'numeric(5,4)'

Note

This function is designed for formatting the cursor-guessed data type. Ensuring the optimal performance of the get_data_types function is crucial.

See also

get_data_types() : Gets a SQL query data types.