Skip to content

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

Closed

Description

@RKrahl

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.

Activity

  1. RKrahl commented on Oct 13, 2021

    @RKrahl
    MemberAuthor

    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.

  2. RKrahl commented on Oct 25, 2021

    @RKrahl
    MemberAuthor

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

  3. added this to the 0.20.0 milestone on Oct 25, 2021
  4. added a commit that references this issue on Oct 25, 2021
    c5f5456
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions