A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/oracle/python-oracledb/issues/15 below:

`oracledb.defaults.fetch_lobs` changes how integers are fetched · Issue #15 · oracle/python-oracledb · GitHub

I have the following table

create table oracledbtest(testint integer);

and I've inserted one record via

insert into oracledbtest values (1);

With this, the following Python script

import oracledb
for fetch_lobs in (False, True):
	oracledb.defaults.fetch_lobs = fetch_lobs
	db = oracledb.connect("user/pwd@db", config_dir='/Users/walter/oracle/instantclient_12_2/network/admin')
	c = db.cursor()
	data = c.execute("select * from oracledbtest").fetchall()
	print(f"{fetch_lobs=}: {data=}")

outputs

fetch_lobs=False: data=[(1.0,)]
fetch_lobs=True: data=[(1,)]

i.e. with oracledb.defaults.fetch_lobs = False integers are fetched as floats, but with oracledb.defaults.fetch_lobs = True they are fetched as ints.

IMHO they should always be fetched as ints.

Versions from

import sys, platform, oracledb

print(f"{platform.platform()=}")
print(f"{sys.maxsize > 2**32=}")
print(f"{platform.python_version()=}")
print(f"{oracledb.__version__=}")

are

platform.platform()='macOS-12.4-x86_64-i386-64bit'
sys.maxsize > 2**32=True
platform.python_version()='3.10.4'
oracledb.__version__='1.0.0'

The database is an Oracle XE 21.0.0.0.0


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4