Custom Postgres Method in Labkey Query

LabKey Support Forum
Custom Postgres Method in Labkey Query sleisle  2021-03-17 16:08
Status: Closed
 

Hello Labkey,

I'm attempting to use a custom postgres method to join two tables in a file-based module query, but when running the query, it errors out stating "Method not found". I saw a similar forum post from 2013 that talked about this being unsupported, but seeing how old the post was I figured I should check if it has been updated. Is there any way to call a custom method, or is it unsupported?

Thanks!

 
 
chetc (LabKey Support) responded:  2021-04-13 15:42

Hello,

Unfortunately, this is still unsupported. Similar to the post you linked, the postgres methods that we do support are documented https://www.labkey.org/wiki/home/Documentation/page.view?name=labkeySql. We have definitely added to the methods we support since that post was created. If you haven't already you should take a look at that document, there maybe another method you could use.

Thanks,
Chet

 
chetc (LabKey Support) responded:  2021-04-14 07:06

Hello,

My apologies, I stated that this was not possible. That is not true, there is a way to create and enable custom database functions. It's not as straightforward as writing a query in the schema browser but involves adding a pass through method in a Java module. Take a look at the link below.

https://github.com/LabKey/platform/blob/aa7e89ca1446b5e797a993bfb6ace04137557a99/api/src/org/labkey/api/query/QueryService.java#L494

Note: This must be done with caution as they become available server-wide, so they need to be safe enough to be allowed in any LabKey SQL query.

Thanks,
Chet