Table doesn't exist within schema

LabKey Support Forum (Inactive)
Table doesn't exist within schema mohara  2024-03-29 12:01
Status: Active
 

Hi Beatrix:

The parameter name in those examples in the python API docs is unfortunately misleading, and it's already on the list to get them updated. In fact there is new documentation for API wrapper itself available here:
https://github.com/LabKey/labkey-api-python/blob/develop/docs/api_wrapper.md

Instead of "project_name", the better way to name it is "container_path" because that's what needs to be provided. To access a list in:
https://atlas.scharp.org/cpas/list/HVTN/Tools and Reports/SCHARP LDO/Assay Tracker/grid.view?listId=24

You'd need to use something more like this (here I've renamed the parameter and fixed the comment):

labkey_server = "atlas.scharp.org"
container_path = "HVTN/Tools and Reports/SCHARP LDO/Assay Tracker"  # Full folder path
context_path = "cpas"
api = APIWrapper(labkey_server, container_path, context_path, use_ssl=True)

schema = "lists"
table =  "HVTN SDMC Lab/Assay Data Status Tracker"
result = api.query.select_rows(schema, table)

It's possible that the slash in the name of the list could also run into issues, so if that doesn't work, try accessing a list name without a slash in it.

A really good way to get a 'starter' snippet of python for any table is to use the Export button, choose Script, and select Python. Clicking 'create script' will then give you the APIWrapper you need to get to that data.
In a local example I just tried, it's also possible you'll need to escape the slashes in the path, if the snippet I provided above doesn't work: i.e.:

container_path = "HVTN\/Tools and Reports\/SCHARP LDO\/Assay Tracker"  # Full folder path

Hopefully that helps,

--Molly