From 3ec1a424166fefd620d524df698f4cf80c9420a4 Mon Sep 17 00:00:00 2001 From: David Stirling Date: Thu, 8 Feb 2024 14:51:23 +0000 Subject: [PATCH] Return FileAnnotation ID when creating table, not OriginalFile ID --- omero2pandas/__init__.py | 2 +- omero2pandas/upload.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/omero2pandas/__init__.py b/omero2pandas/__init__.py index 9b4bbb0..ecfb52b 100644 --- a/omero2pandas/__init__.py +++ b/omero2pandas/__init__.py @@ -202,7 +202,7 @@ def upload_table(dataframe, table_name, parent_id, parent_type='Image', :param port: Port the server runs on (default 4064) :param username: Username for server login :param password: Password for server login - :return: File annotation ID of the new table + :return: File Annotation ID of the new table """ with OMEROConnection(server=server, username=username, password=password, port=port, client=omero_connector) as connector: diff --git a/omero2pandas/upload.py b/omero2pandas/upload.py index 3eb5afe..79d2340 100644 --- a/omero2pandas/upload.py +++ b/omero2pandas/upload.py @@ -126,13 +126,13 @@ def create_table(df, table_name, parent_id, parent_type, conn, chunk_size): annotation.file = orig_file link_obj.link(target_obj, annotation) - conn.getUpdateService().saveObject(link_obj, _ctx={ - "omero.group": str(parent_group)}) + link_obj = conn.getUpdateService().saveAndReturnObject( + link_obj, _ctx={"omero.group": str(parent_group)}) LOGGER.info("Saved annotation link") LOGGER.info(f"Finished creating table {table_name} under " f"{parent_type} {parent_id}") - return orig_file.id.val + return link_obj.child.id.val finally: if table is not None: table.close()