Kevin McGinn · Mar 21, 2022

Need help converting from objectscript query into Python query

I have the object query:

s Rset=##class(%ResultSet).%New("%SYSTEM.License.UserListAll")

I can loop through that query and it generates the report information that I need.

I have a Python process where I use the intersys import to connect to the Cache instance. But I have been unable to determine the correct syntax in Python for this query. Being that 'UserListAll' is a query I attempted to user:

res = <query>.prepare("select * from %SYSTEM.License_UserListAll")

That failed stating 'UserListAll' did not exist. Though this did not seem to be correct, I also attempted:


Product version: Caché 2018.1
0 228
Discussion (2)2
Log in or sign up to continue

In talking to Intersystems in regards to this issue, the query that I would need to use is not defined as a proc. Unknown if that will be corrected in the future or not.

The prescribed solution was stated as:

"...So the solution requires writing your own method in ObjectScript that uses %ResultSet to run the query. Your method then loops through the results, and creates something that can be returned. You call your method from Python" [ ]

So I am closing this issue out. I may pursue that approach at a later date.

A little bit more detail. The queries in %SYSTEM.License are not defined as [SqlProc]s. Therefore, they can't be called from outside IRIS, including from Python. To get the information returned by these queries in Python, you should write your own method in ObjectScript, that runs the query with the (deprecated) %Library.ResultSet class. As you loop through the results: