Skip to content

Set argument for redshift connection/cursor in order to fetch float instances? #95

@ni-todo-spot

Description

@ni-todo-spot

Driver version

2.0.905

Redshift version

PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.36224��

Client Operating System

Darwin Nativs-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:34:37 PST 2022; root:xnu-8020.101.4~2/RELEASE_X86_64 x86_64

Python version

3.8.7

Problem description

I was wondering if there is some kind of a flag / setting I can set in order to tell the connector return a numeric result as float / np.float instead of decimal.Decimal instance?

I was using the following raw sql on a cursor instance:

cursor.execute("SELECT 1.0 / 7 AS foo")
df = cursor.fetch_dataframe()
output = df.squeeze()
assert not isinstance(output, decimal.Decimal)

Thanks in advance!

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