Loading...

vastorbit.vast_python_dtype

vastorbit.vast_python_dtype(type_name: str, display_size: int = 0, precision: int = 0, scale: int = 0) str

Takes as input the Trino type information and returns its corresponding data type string.

Parameters:
  • type_name (str) – Type Name.

  • display_size (int, optional) – Display Size.

  • precision (int, optional) – Type Precision.

  • scale (int, optional) – Scale.

Returns:

The final type.

Return type:

str

Examples

Let’s import the function before proceeding.

from vastorbit.sql import trino_dtype

Let’s format a varchar data type.

trino_dtype('varchar', 666)

Let’s format a decimal data type.

trino_dtype('decimal', precision = 5, scale = 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.