Skip to content

Decimal data type returned as strings #150

@tatbt

Description

@tatbt

Issue:

I am using python to pull data from a Trino database, and columns formatted as DECIMAL in the database are returned as strings rather than numbers.

For Instance:

import trino
conn = trino.dbapi.connect(
host='host'
port=port
user='user'
catalog='catalog'
schema='schema'
)
cur = conn.cursor()
cur.execute("SELECT DECIMAL_COL FROM TABLE LIMIT 5")
rows = cur.fetchall()
print(rows)

This is an example of the output I get:

[['123456.78'],['234567.89'],['3456.78'],['45678.90'],['67.89']]

Is the output above what is expected? I would expect this to be returned as numbers rather than strings. I do not encounter this issue with integers or double data types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions