How to export a folder with linked schemas

LabKey Support Forum
How to export a folder with linked schemas alx dobre  2015-08-25 07:49
Status: Closed
 
Hello,

When I try to export the folder structure via Admin-> Folder -> Management -> Export, I can export folders just fine except the ones where I have linked schemas defined.

When I try to export such a folder I get the following error message:
Could not find schema <linked schema name> in <folder name I was trying to export>for user null with query <query name based on linked schema>.

I searched around for the meaning of the above error message and I found this issue referencing it but it does not help with my troubles:
https://www.labkey.org/issues/home/Developer/issues/details.view?issueId=23317

So how can I export a folder with queries that are based on linked schemas please?
 
 
Jon (LabKey DevOps) responded:  2015-08-25 11:26
Hi Alex,

I can't seem to reproduce this problem. When I create a linked schema, I can export the folder without any issue.

Can you provide us with the full stack error? Is there a schema template in use? If this is an actual linked schema, then there has to be a source. Does that source schema produce any errors when you try to run a validation query on it?

Regards,

Jon
 
alx dobre responded:  2015-08-26 02:12
Right so I did an experiment as well and it went like this.

Created a new folder and added one linked schema -> export went OK including the linked schema
Added a query based on the linked schema -> got the error.

Please note the query is valid.

Please see attached the labkey error file.

The log shows a null pointer:
Error creating linked schema test_linked_schema
java.lang.NullPointerException
    at org.labkey.query.LinkedSchema$LinkedSchemaUserWrapper.<init>(LinkedSchema.java:452)

And then the error that gets displayed on screen:
Unexpected server error
java.lang.IllegalStateException: Could not find schema test_linked_schema in /Genomics England/ext_sch_test for user null with query test_linked_schema_temp_214
    at org.labkey.query.QueryDefinitionImpl.getSchema(QueryDefinitionImpl.java:412)
 
Jon (LabKey DevOps) responded:  2015-08-26 14:16
Hi Alex,

When you imported the folder, did you configure the linked schema under the Schema Browser > Schema Administration?

The Linked Schema uses a Source Container, Source Schema, and Published Tables. If your Source Container, Source, Schema, and/or your Published Tables don't already exist in the instance of LabKey you imported the folder into, you will have to configure that information.

Regards,

Jon
 
alx dobre responded:  2015-08-27 02:09
Hello Jon,

Yes I am aware of the above.

Please note that your reply deals with a folder import issue while I am having a folder export issue. I get the error when trying to export a folder with a properly configured external schema and a query that depends on it which is valid.
 
Jon (LabKey DevOps) responded:  2015-08-27 16:23
Hi Alex,

My apologies for the confusion here. When you had put down:

"Created a new folder and added one linked schema -> export went OK including the linked schema
Added a query based on the linked schema -> got the error."

I assumed that meant that you were not having a problem with exports, but rather imports.

But I did reproduce the issue successfully. It seems to be isolated to having custom queries on those linked schema tables.

I'll setup a bug on this problem, but it appears that if you want to do an export, you will have to make copies of those custom queries, delete them, export your folder, then put them back.

Regards,

Jon
 
Jon (LabKey DevOps) responded:  2015-08-27 16:33
The following bug ticket has been made for this issue:

https://www.labkey.org/issues/home/Developer/issues/details.view?issueId=24155
 
alx dobre responded:  2015-08-28 01:32
Understood,

In the meantime I found another workaround for the issue. I am able to export just the schemas and just the queries separately.

Then if I combine the two exports and craft the folder xml properly then zip it up it uploads properly. So the upload of a linked schema + custom query works. The download in combination throws the error but separately it works.
 
Jon (LabKey DevOps) responded:  2015-08-28 12:07
Thanks for confirming the workaround on your end Alex. We'll keep you informed on when the bug has been fixed.

Regards,

Jon
 
alx dobre responded:  2015-09-03 03:06
A further interesting find in this bug. It seems to be caused by the "custom views" export option. The export works as long as that option is left unchecked.

This is on 15.2
 
Jon (LabKey DevOps) responded:  2015-09-03 11:12
Thanks for letting us know Alex! I've updated the bug with the additional information as well.

Regards,

Jon
 
Jon (LabKey DevOps) responded:  2015-10-22 22:52
Hi Alex,

This is to let you know, this issue has been fixed in our upcoming release of LabKey 15.3, so you will no longer need to remove the custom queries attached to linked schemas on any folder exports.

Regards,

Jon