Using Python API to query Panorama data

LabKey Support Forum (Inactive)
Using Python API to query Panorama data Jon (LabKey DevOps)  2017-05-23 12:04
Status: Closed
 
Hello,

Are you needing information on how to write the API call in Python?

Python GitHub page you referenced has examples there in the readme doc: https://github.com/LabKey/labkey-api-python/blob/master/README.md

The underlying schemas and tables/queries used with the API can be obtained by using the Schema Browser in LabKey by going to Admin > Developer Links > Schema Browser.

So for example, if you needed to run a selectRows() call via Python on a targetedms schema and the annotationsettings table, your query would look something like this:

==================
from labkey.utils import create_server_context
from labkey.query import select_rows

server_context = create_server_context(labkey_server, project_name, contextPath, use_ssl=False)

print("Create a server context")
labkey_server = 'localhost:8080'
project_name = 'MyTargetedMSProject' # Project folder name
contextPath = 'labkey'
schema = 'targetedms'
table = 'annotationsettings'

result = select_rows(server_context, schema, table)
if result is not None:
    print(result['rows'][0])
    print("select_rows: Number of rows returned: " + str(result['rowCount']))
else:
    print('select_rows: Failed to load results from ' + schema + '.' + table)
==================

Is this what you were looking for or are you looking for something else?

Regards,

Jon