irods/irods_client_icommands

showing metadata ID

fh-afk opened this issue · 5 comments

Due to this bug irods-contrib/metalnx-web#234 I got some AVU entries in ICAT which I was not able to delete with imeta rm ..., iRODS complained about empty string being invalid, I was able to delete it with "imeta rmi...", but I do not see an obvious way to obtain the metadata ID with the icommands (I got that info with a little python-irodsclient script).

I suggest to print the metadata ID with imeta ls -V...

By the way, imeta ls -d file, imeta ls -d -v file and imeta ls -d -V file print the exact same output in my test environment which leaves me somewhat confused about the point of the options -v and -V.

mcast commented

iquest from the standard icommands will give you the META_DATA_ATTR_ID.

Here's my nearest dev zone file with some AVUs,

mca@casm3-head2:~$ i-cgpdev iquest '%s %s %s %s' "select DATA_ID, META_DATA_ATTR_ID, META_DATA_ATTR_NAME, META_DATA_ATTR_VALUE where COLL_NAME = '/cgp_dev/home/mca2' and DATA_NAME = 'dict-move.pl'"
33464 33465 t-mca-CANT.id_ifile 3892804
33464 33461 t-mca-CANT.md5 ea168b18a53952b38e8ba448d2653f9d
mca@casm3-head2:~$ i-cgpdev imeta ls -d /cgp_dev/home/mca2/dict-move.pl
AVUs defined for dataObj /cgp_dev/home/mca2/dict-move.pl:
attribute: t-mca-CANT.md5
value: ea168b18a53952b38e8ba448d2653f9d
units: 
----
attribute: t-mca-CANT.id_ifile
value: 3892804
units: 
mca@casm3-head2:~$ i-cgpdev imeta rmi -d /cgp_dev/home/mca2/dict-move.pl 33464
remote addresses: 172.30.157.15 ERROR: rcModAVUMetadata failed with error -819000 CAT_SUCCESS_BUT_WITH_NO_INFO 

so DATA_ID is correctly rejected, being an id for the entire file, although if I didn't know why then I'm not sure the error message would help me much.

mca@casm3-head2:~$ i-cgpdev imeta ls -d /cgp_dev/home/mca2/dict-move.pl
AVUs defined for dataObj /cgp_dev/home/mca2/dict-move.pl:
attribute: t-mca-CANT.md5
value: ea168b18a53952b38e8ba448d2653f9d
units: 
----
attribute: t-mca-CANT.id_ifile
value: 3892804
units: 
mca@casm3-head2:~$ i-cgpdev imeta rmi -d /cgp_dev/home/mca2/dict-move.pl 33461
mca@casm3-head2:~$ i-cgpdev imeta ls -d /cgp_dev/home/mca2/dict-move.pl
AVUs defined for dataObj /cgp_dev/home/mca2/dict-move.pl:
attribute: t-mca-CANT.id_ifile
value: 3892804
units: 

I think this is correct but I'm not sure it addresses all of your problem..?

Yes, the iquest command would have been a solution for my specific problem, too. However, this requires an iRODS admin to also be familiar with the specific SQL database structure behind iCAT which is not that well documented. META_DATA_ATTR_ID is not even mentioned in the documentation if iquest.

rcModAVUMetadata failed with error -819000 CAT_SUCCESS_BUT_WITH_NO_INFO - It did not take long for me to figure out the meaning of this when I encountered the same message, but it is misleading and confusing, something more to the point, e.g. "ERROR: Metadata ID not found" would be nice.

In any case, I agree there are ways to get the Metadata ID, I mentioned this myself, but I still think my suggestion would a be a good idea - this way an iRODS admin might not even have to know the SQL column names.

trel commented

Hi @fh-afk, iquest attrs will present all the available columns for query/listing. And that is available to any user, not just rodsadmins.

That said, yes, the verbosity flags are a bit of a mess throughout the iCommands. We're looking to fix those as we find egregious ones. This one could certainly be more helpful.

Hi @trel, iquest attrs comes in handy when you really want to work on SQL level, so thank you very much for this hint. Unfortunately, it does not print any documentation for those columns, most of the column names are self explanatory, but not all of them, but this is probably very subjective (depending on the level of iRODS experience). I would still consider it a good idea to fully abstract from the SQL database and not even touch it directly once iRODS is fully set up an running.
Anyway, this is only a suggestion. As always, your input was very valuable. Have a nice day!

trel commented

Closing - no further work to be done.