Query for DatasetImageLink ID

Hi OME team,
Is there an easy way (other than using hql) to query for the ID of a DatasetImageLink object (or other …Link objects) from the CLI? I want to programmatically move a bunch of Images from one Dataset to another and need to sever the Link from the old Dataset but don’t know the ID of that Link.

If hql is the only way, could you give me a hint how to structure the hql query? I know the Dataset ID and the Image ID.
Thanks,
Damir

I’ll look into a non-HQL solution, but to get you something in hand over the weekend:

select dil.id from DatasetImageLink dil where dil.parent.id = 51 and dil.child.id=1884807

will return the ID of the link.

~Josh

Thanks Josh. Much appreciated. I’m trying to track down the details of a (already submitted via QA system, IDs: 29254 and 29255) bug where interactively moving a Image from one Dataset to another one fails on .web with an error: “TypeError: the JSON object must be str, not ‘bytes’” and when doing the same in Insight, it fails silently. This is on Ubuntu 16.04 which has 3.5 as the Python version. And this happens on 2 separate OMERO 5.6.1 instances.
Doing it via the CLI (with your help) works fine:

omero obj new DatasetImageLink parent=Dataset:1402 child=Image:591151
omero hql "select dil.id from DatasetImageLink dil where dil.parent.id = 51 and dil.child.id=591151"
...
 # | Col1
---+--------
 0 | 591101
(1 row)
...
omero delete DatasetImageLink:591101

Thanks,
Damir

No problem.

I’ve filed https://github.com/ome/omero-web/issues/169 until we can reproduce. If you can try with Python 3.6 and let us know on the issue, that’d be great.

~Josh

I noticed on github that @mtbc already confirmed the issue with Python 3.5 (and filed a PR) and that the issue isn’t there with Python 3.6 (I confirmed that as well on my Ubuntu 18.04 test system). Thanks for the quick action. I’ll investigate how I can easiest get to Python 3.6+ on my Ubuntu 16.04 servers. Install from third-party PPA or Conda or pyenv … or upgrade to 18.04 … so many choices :frowning:

While investigating this issue I came across some anomalous behavior that’s probably unrelated (and has probably been there for a long time): using Insight I cannot move an Image from one Dataset to another iff I’m working with someone else’s data while logged in as myself (I’m the top-level administrator and should have all the permissions needed). Plus this is in a read-annotate group where I’m the owner. The move attempt just fails silently and I cannot find anything in any of the logs (server-side or client-side).
When I try to do the same action using the CLI (per above), it works fine as expected. And doing this same action using Web (on my Ubuntu 18.04 test system), it also works fine. So the unexpected behavior is only with Insight. (I also checked an older OMERO 5.4.10 server where the anomalous behavior is identical.)

Cheers,
Damir

Hi Damir,
thanks for spotting this. I’d expect this workflow to work in Insight too.
Created a respective Github issue for it: https://github.com/ome/omero-insight/issues/131
Cheers,
Dominik

Thanks Dominik.
With Susanne’s new MDE extension (OMERO.mde tutorial), Insight is an exciting place again.
Cheers,
Damir

Just FYI, I hacked @mtbc 's PR into my running instance under Python 3.5 and it works just fine. I know that’s not advisable but may provide a quick patch to tide things over. For me, it’s until I upgrade the server to Ubuntu 18.04.
Thanks both,
Damir

1 Like