Python interaction with Config.config class not returning gmheap size
I am trying to extract GMHeap, Locksiz values form Config.config using python (imported irisnative for Python) but the below python progam is not returning any value. Please suggest if i am doing any mistake -
Also, plese suggest how i can set values for GMHeap and Locksiz to a different value through Python.
import irisnative
hostname = "127.0.0.1"
port = 1972
namespace = "%SYS" #change the namespace based on situation
username = "_SYSTEM"
password = "xxxxxxxx"
connection = irisnative.createConnection(hostname, port, namespace, username, password)
dbnative = irisnative.createIris(connection)
gmheap_size=dbnative.classMethodValue("Config.config", "gmheap")
print(gmheap_size)
connection.close()
Comments
You're trying to call gmheap as a class method, but it's a property. Here's one way to do it:
cfg = native.classMethodValue('Config.config', 'Open')
cfg.get('gmheap')
Hi,
I tried updating the python script like below -
import irisnative
hostname = "127.0.0.1"
port = 1972
namespace = "%SYS" #change the namespace based on situation
username = "_SYSTEM"
password = "xxxxxxxx"
connection = irisnative.createConnection(hostname, port, namespace, username, password)
dbnative = irisnative.createIris(connection)
cfg=dbnative.classMethodValue('Config.config', 'Open')
print(cfg.get('gmheap'))
connection.close()
and i am getting the below error when i attempting to run python -
print(cfg.get('gmheap'))
AttributeError: 'str' object has no attribute 'get'
i tried methog gmheapGet() for the property gmheap but i am not getting any output. This Config.config is persistent class and SQL table. is that is the reason 'classmethovalue' not working? the same code worked for getting %system.config.sharedmemoryheap.recommendedsize.
What version of IRIS are you using, and what version of the Native API wheel? This works for me in 2024.1.0 using both 3.2.0 and 4.2.0.
Hi Jon, I am using IRIS Version as below -
IRIS for Windows (x86-64) 2023.1.2 (Build 450_0_23065U) Thu Dec 28 2023 14:31:25 EST [Health:5.1.0-1.m1]
and Native driver - i have downloaded the whl file "irisnative-1.0.0-cp34.cp35.cp36.cp37.cp38.cp39-none-win_amd64.whl"
1.0.0 is very old. 2023.1.2 shipped with the 3.2.0 and 4.1.0 wheels in the dev/python directory. You're going to be happier using one of them, which support the answer I gave originally. A big difference between the two is that 3.2.0 is pure Python, whereas 4.1.0 includes platform-specific binaries like 1.0.0 did.
Hi Jon,
Can you please share the link for the updated wheel file please
As @Jon Willeke wrote in his post:
2023.1.2 shipped with the 3.2.0 and 4.1.0 wheels in the dev/python directory
It's in the dev/python directory of your IRIS installation. It's in your system.
I have downloaded this below wheel from GitHub. IF this not the latest wheel, please can you share new link please -
"irisnative-1.0.0-cp34.cp35.cp36.cp37.cp38.cp39-none-win_amd64.whl"
💡 This question is considered a Key Question. More details here.