Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-22205

Surprising error when passing a string to queryDimensions

    Details

    • Team:
      DM Science

      Description

      Calling `butler.queryDimensions("calibration_label")` gave me this exception:

          def __getitem__(self, name: str) -> T:
      >       return self._dict[name]
      E       KeyError: 'c'
      

      The method wants an `Iterable`, which `str` is, but `str` is not the right kind of iterable in this case. I think a test at the start of the method that raises a TypeError would clarify this. A test in `test_sqlRegistry` for this case also.

      if isinstance(dimensions, str):
          raise TypeError("`dimensions` argument cannot be a single string.")
      

        Attachments

          Activity

          Hide
          jbosch Jim Bosch added a comment -

          Leanne Guy and Jim Bosch are bootcamp pair-coding this.

          Show
          jbosch Jim Bosch added a comment - Leanne Guy and Jim Bosch are bootcamp pair-coding this.
          Hide
          nlust Nate Lust added a comment -

          See github

          Show
          nlust Nate Lust added a comment - See github
          Hide
          lguy Leanne Guy added a comment -

          Resolved by making this work rather than throwing a better exception

          Show
          lguy Leanne Guy added a comment - Resolved by making this work rather than throwing a better exception

            People

            • Assignee:
              lguy Leanne Guy
              Reporter:
              Parejkoj John Parejko
              Reviewers:
              Nate Lust
              Watchers:
              Jim Bosch, John Parejko, Leanne Guy, Nate Lust, Tim Jenness
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel