<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hi Matthias,</p>
    <p>ah, that makes a lot of sense. So this can be used as a hint for
      optimisation of the ~"bandwidth" of the function so to speak. What
      a cool feature! My dataset was a tiny local geopackage so no
      surprise it just gave me access to all columns straight-away.</p>
    <p>When I find time to make a PR I'll add a clearer sentence to the
      documentation and to change the new function template to either
      remove the parameter (so it uses the default) or make it use
      QgsFeatureRequest.ALL_ATTRIBUTES explicitely as hint that one
      could optimize that. (I prefer to remove it, it's optional with a
      sensible default...)<br>
    </p>
    <p>Cheers<br>
      Hannes<br>
    </p>
    <div class="moz-cite-prefix">Am 22.11.21 um 14:48 schrieb Matthias
      Kuhn:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAC7zN94VDp033z32aRbVC=aVujc0GcaeO2jNkwic3SjwDu=JHw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi Hannes,
        <div><br>
        </div>
        <div>This information can be used by the expression engine to
          determine what needs to be requested from the provider.</div>
        <div>This can lead to significant performance improvements,
          depending on the scenario.</div>
        <div><br>
        </div>
        <div>Depending on other functions used in the expression and the
          capabilities of the provider itself, the request may or may
          not include them.</div>
        <div><br>
        </div>
        <div>As stated in the help, it's what the function *requires*,
          these attributes are guaranteed to be available. Others may
          still be there.</div>
        <div><br>
        </div>
        <div>Cheers</div>
        <div>Matthias</div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Mon, Nov 22, 2021 at 2:41
          PM Johannes Kröger (WhereGroup) <<a
            href="mailto:johannes.kroeger@wheregroup.com"
            target="_blank" moz-do-not-send="true">johannes.kroeger@wheregroup.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi
          list,<br>
          <br>
          <a
href="https://docs.qgis.org/3.22/en/docs/user_manual/expressions/expression.html#function-editor"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://docs.qgis.org/3.22/en/docs/user_manual/expressions/expression.html#function-editor</a>
          <br>
          mentions the optional keyword argument "referenced_columns" to
          the <br>
          `@qgsfunction` decorator. It says<br>
          <br>
           > referenced_columns=[list]: An array of attribute names
          that are <br>
          required to the function. Defaults to<br>
           > [QgsFeatureRequest.ALL_ATTRIBUTES].<br>
          <br>
          That, and examples where it is used in other people's code,
          led me to <br>
          believe that the feature's attributes would not be accessible
          unless <br>
          listed in that parameter or if the parameter was omitted
          (-> default <br>
          value getting used -> default is all attributes).<br>
          <br>
          The default code that gets inserted into the editor includes
          the <br>
          decorator `@qgsfunction(args='auto', group='Custom', <br>
          referenced_columns=[])` so I'd assume that I would not be able
          to use <br>
          any attributes in the function.<br>
          <br>
          In reality I can access them just fine though, e. g.
          `feature["name"]` <br>
          if I had features with a "name" attribute and that default <br>
          `referenced_columns=[]`.<br>
          <br>
          I can even do so if I used `referenced_columns=["foo",
          "bar"]`! <br>
          `feature["name"]` is still perfectly accessible.<br>
          <br>
          Is this a bug or by design? If by design, what purpose does
          this <br>
          parameter have?<br>
          <br>
          Thanks<br>
          Hannes<br>
          <br>
          -- <br>
          Johannes Kröger / GIS-Entwickler/-Berater<br>
          WhereGroup GmbH<br>
          Eifelstraße 7<br>
          53119 Bonn<br>
          Germany<br>
          <br>
          Tel: +49 (0)228 / 90 90 38 - 36<br>
          Fax: +49 (0)228 / 90 90 38 - 11<br>
          <br>
          <a href="mailto:johannes.kroeger@wheregroup.com"
            target="_blank" moz-do-not-send="true">johannes.kroeger@wheregroup.com</a><br>
          <a href="http://www.wheregroup.com" rel="noreferrer"
            target="_blank" moz-do-not-send="true">www.wheregroup.com</a><br>
          Geschäftsführer:<br>
          Olaf Knopp, Peter Stamm<br>
          Amtsgericht Bonn, HRB 9885<br>
          -------------------------------<br>
          <br>
          ********************************************<br>
          Where2B Konferenz 2021<br>
          16. Dezember 2021<br>
          im Universitätsclub Bonn und online<br>
          <a href="https://where2b-conference.com/" rel="noreferrer"
            target="_blank" moz-do-not-send="true">https://where2b-conference.com/</a><br>
          ********************************************<br>
          <br>
          _______________________________________________<br>
          QGIS-Developer mailing list<br>
          <a href="mailto:QGIS-Developer@lists.osgeo.org"
            target="_blank" moz-do-not-send="true">QGIS-Developer@lists.osgeo.org</a><br>
          List info: <a
            href="https://lists.osgeo.org/mailman/listinfo/qgis-developer"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
          Unsubscribe: <a
            href="https://lists.osgeo.org/mailman/listinfo/qgis-developer"
            rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
        </blockquote>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Johannes Kröger / GIS-Entwickler/-Berater
WhereGroup GmbH
Eifelstraße 7
53119 Bonn
Germany

Tel: +49 (0)228 / 90 90 38 - 36
Fax: +49 (0)228 / 90 90 38 - 11

<a class="moz-txt-link-abbreviated" href="mailto:johannes.kroeger@wheregroup.com">johannes.kroeger@wheregroup.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.wheregroup.com">www.wheregroup.com</a>
Geschäftsführer:
Olaf Knopp, Peter Stamm 
Amtsgericht Bonn, HRB 9885
-------------------------------

******************************************** 
Where2B Konferenz 2021
16. Dezember 2021
im Universitätsclub Bonn und online
<a class="moz-txt-link-freetext" href="https://where2b-conference.com/">https://where2b-conference.com/</a>
******************************************** 
</pre>
  </body>
</html>