oracledb.defaults.fetch_lobs
changes how integers are fetched · Issue #15 · oracle/python-oracledb (original) (raw)
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 float
s, but with oracledb.defaults.fetch_lobs = True
they are fetched as int
s.
IMHO they should always be fetched as int
s.
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