icatproject/python-icat

join_specs is missing from the output of Query.__repr__()

Closed this issue · 2 comments

The formal string representation operator __repr__() of class Query omits the join_specs attribute:

>>> query = Query(client, "Rule", order=['grouping', 'what', 'id'], join_specs={"grouping": "LEFT OUTER JOIN"})
>>> repr(query)
"Query(<icat.client.Client object at 0x7f1e16158860>, 'Rule', attributes=[], aggregate=None, order=[('grouping.name', None), ('what', None), ('id', None)], conditions={}, includes=set(), limit=None)"

This is related to #90: both methods, copy() and __repr__() have simply been forgotten to update in #85.

In principal, this would be trivial to fix. But there is another problem with __repr__() at the horizon: the output of it should look like a valid Python expression that could be used to recreate an object with the same value. But, #89 will likely change the internal data structures in the conditions attribute to an extent that it will not be practical to reconstruct suitable keyword arguments to Query() from that.

As a result, I'm inclined to wontfix this issue and to deprecate Query.__repr__() in 0.20.0 instead, so it would be dropped in 1.0.0. Not sure if anybody uses it anyway.

I finally decided to fix this one and to deal with the issues resulting from #89 in a separate issue, see #94.