04-22-2022 05:36 AM
sql = '''select * from device where name = "ATAD4ADBDCECF72" '''
# Execute the executeSQLQuery request
try:
resp = service.executeSQLQuery( sql )
except Fault as err:
print('Zeep error: executeSQLQuery: {err}'.format( err = err ) )
else:
print( '\nexecuteSQLQuery response:' )
print( resp )
The following is the result:
executeSQLQuery response:
{
'return': {
'row': [
[
<Element pkid at 0x108277780>,
<Element name at 0x1082777c0>,
<Element description at 0x108277800>,
<Element tkmodel at 0x108277840>,
<Element tkdeviceprotocol at 0x108277880>,
<Element tkprotocolside at 0x1082778c0>,
<Element specialloadinformation at 0x108277900>,
<Element fkdevicepool at 0x108277940>,
<Element fkphonetemplate at 0x108277980>,
<Element fkcallingsearchspace at 0x1082779c0>,
<Element ctiid at 0x108277a00>,
<Element tkclass at 0x108277a40>,
<Element fkprocessnode at 0x108277a80>,
<Element defaultdtmfcapability at 0x108277ac0>,
The following is what I get if I run the same query from CLI, which is what I expect
9f4e0c6b-6dd8-3c35-cce4-1a933af6db5e ATAD4ADBDCECF72 TX-JST-258 PAGING ATA 36262 11 1 704d9468-d9a7-175c-a441-21468d445491 50155d0c-a8ca-4a6c-93f1-96ac528d3518 5ea64ecb-9588-d8ef-a2f4-5f9e7187f31e 83176 1 NULL 0 eaa446f1-56e3-8137-ef7a-076c3bb3295a 36715 NULL f 0ed8c1a1-dbf1-4c63-295a-2f2b5bf50d4c f 0 NULL NULL 2 NULL 0 0 64 1 NULL NULL NULL NULL t f NULL 0 0 2 f 4 0 0 1 NULL f f 2 f 1 d866cf12-ab4f-44cd-8cfc-e19e8b131a49 NULL NULL NULL f 1 f NULL fcbc7581-4d8d-48f3-917e-00b09fb39213 f f NULL NULL ad243d17-98b4-4118-8feb-5ff2e1b781ac cb8b5944-5226-1e61-2ee0-0837b73d3ff8 0 1 f f t 1 1635873403-6ce180f5-dd3f-4beb-a03e-8584e6b9439c 6077e70d-b810-76d4-9d20-bd101f89c462 f f
04-22-2022 03:38 PM - edited 04-25-2022 04:49 PM
Hi Young,
The 'resp' object is a dictionary of list of list of objects. You may want to try to de-reference the obj to print out the value. For example:
record = resp['row'][0]
print(record)
or
print(record['pkid'])
In Python, it's helpful to use print(type(obj)) to determine if obj is a list or a dictionary or first class variable type then go from there.
Hope that helps.
-david
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide