python-irodsclient icon indicating copy to clipboard operation
python-irodsclient copied to clipboard

method for 'list tickets'

Open trel opened this issue 7 years ago • 4 comments

similar to functionality provided by:

  • iticket ls
  • iticket ls-all

trel avatar Mar 12 '18 12:03 trel

I've investigated today in this point. Since this informations are found in the iCAT database it's not too difficult to have it working:

  1. Add a Ticket class to the SQL models (models.py) in your library:
class Ticket(Model):
    """ see rodsGenQuery.h in irods """
    id = Column(Integer, 'COL_TICKET_ID', 2200)
    string = Column(String, 'COL_TICKET_STRING', 2201)
    type = Column(String, 'COL_TICKET_TYPE', 2202)
    user_id = Column(Integer, 'COL_TICKET_USER_ID', 2203)
    object_id = Column(Integer, 'COL_TICKET_OBJECT_ID', 2204)
    uses_limit = Column(Integer, 'COL_TICKET_USES_LIMIT', 2206)
    uses_count = Column(Integer, 'COL_TICKET_USES_COUNT', 2207)
    expiration = Column(DateTime, 'COL_TICKET_EXPIRY_TS', 2208)
    # created = Column(DateTime, 'COL_TICKET_CREATE_TIME', 2209)  # does not work in my test
  1. Make queries:
from irods.models import Ticket, DataObject, User

data = sess.query(
    # Ticket.id,
    Ticket.string, Ticket.type, User.name, DataObject.name,
    Ticket.uses_limit, Ticket.uses_count,
    Ticket.expiration
).all()  # could trigger NoResultFound

pdonorio avatar Mar 15 '18 10:03 pdonorio

COL_TICKET_CREATE_TIME should get handled correctly once https://github.com/irods/irods/issues/5929 is fixed/merged.

trel avatar Oct 18 '21 15:10 trel

irods/irods#5929 was fixed/included in 4.2.11 and 4.3.0.

trel avatar Jan 17 '23 01:01 trel

Still a little work to do it appears...

https://github.com/irods/python-irodsclient/blob/4818f65882245d053d9cb773e5aee5b00b7d7f64/irods/models.py#L248-L250

trel avatar Mar 15 '25 02:03 trel