Question
Kevin McGinn · Mar 4

I need the status values of databases of a 2017.1.xx cache instance

I am using the 

import intersys.pythonbind3 as pyb

conn     = pyb.connection()
conn.connect_now(...)
    
db      = pyb.database(conn)
qry        = pyb.query(db)
obj        = pyb.object(db)

for connection to the cache instance

However when I run this class method, The error message  indicates the method does not exist:

print(db.run_class_method("SYS.Database","GetStatus",[]))

intersys.pythonbind3.cache_exception: file=intersys/pythonbind3.c line=3034 err=-1000 message=<METHOD DOES NOT EXIST> 148 runMtdLow+22^%SYS.BINDSRV GetStatus,SYS.Database

 

I can not find the class reference docs for 2017. I am guessing the name has changed since that early version of cache.

I would like to know if someone has a link to the class reference doc for 2017 cache or does someone know of another method of getting database status values?

0
0 90
Discussion (3)1
Log in or sign up to continue

GetStatus is available in 2017.1 but it's an instance method, not a class method, so you can't call it this way.

You need to wrap it in a class method.

Thank-you for the response. I now have found the class reference for 2017 where it is specified as a method as opposed to a classmethod.

Would you mind elaborating a bit on your statement "...wrap it in a class method". I see that in object script there is the $METHOD() which appears to be what I need but I am not find finding an equivalent python method.

Write a classmethod:

ClassMethod GetStatus(dbFolder) As %String
{
   new $namespace
   set $namespace = "%SYS"
   set db = ##class(SYS.Database).%OpenId(dbFolder)
   quit db.GetStatus()
}

And call it from Python.