Mailing List Archive

Extending the SelectQueryBuilder
Hi,

The SelectQueryBuilder class was introduced a year ago
<https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/455RLQ5M6HT5AM5HXBCWJGDM2ELHSV57/#455RLQ5M6HT5AM5HXBCWJGDM2ELHSV57>
and it's seen some adoption, mostly in core. I've also noticed that
there are two classes that extend it in core, the PageSelectQueryBuilder
and UserSelectQueryBuilder. I really like how this approach allows for
better separation of DB code from the rest, which has always been a
complete and utter mess in MW. I would like to do something similar in
an extension, but the base class is currently not explicitly marked as
stable to extend and thus, according to the stable interface policy
<https://www.mediawiki.org/wiki/Stable_interface_policy#Stable_to_extend>,
the interface could be broken at any time. My question is – are there
any plans to make the class stable to extend? Is there a rough roadmap
for its development? If the class is unstable to extend for some reason
– what are the expected changes to come?

Thanks!

--

Ostrzyciel
Re: Extending the SelectQueryBuilder [ In reply to ]
Hello, Ostrzyciel.

SelectQueryBuilder was marked as @stable to extend in [1]. Please note that it’s ok to extend SelectQueryBuilder in extensions now,
but I didn’t mark any of it’s methods as @stable to override. This should be enough to create specialized query builders, like
UserSelectQueryBulder or PageSelectQueryBuilder in core, while leaving us some freedom to potentially change how SelectQueryBuilder
Works internally later on. If you need to override some of the methods, please do tell.

Best regards. Petr.
Staff Software Engineer.
Platform Engineering Team.
WMF.

1. https://gerrit.wikimedia.org/r/c/mediawiki/core/+/701940 <https://gerrit.wikimedia.org/r/c/mediawiki/core/+/701940>


> On Jun 20, 2021, at 9:26 AM, Ostrzyciel <ostrzycielnozyczek@gmail.com> wrote:
>
> Hi,
>
> The SelectQueryBuilder class was introduced a year ago <https://lists.wikimedia.org/hyperkitty/list/wikitech-l@lists.wikimedia.org/thread/455RLQ5M6HT5AM5HXBCWJGDM2ELHSV57/#455RLQ5M6HT5AM5HXBCWJGDM2ELHSV57> and it's seen some adoption, mostly in core. I've also noticed that there are two classes that extend it in core, the PageSelectQueryBuilder and UserSelectQueryBuilder. I really like how this approach allows for better separation of DB code from the rest, which has always been a complete and utter mess in MW. I would like to do something similar in an extension, but the base class is currently not explicitly marked as stable to extend and thus, according to the stable interface policy <https://www.mediawiki.org/wiki/Stable_interface_policy#Stable_to_extend>, the interface could be broken at any time. My question is – are there any plans to make the class stable to extend? Is there a rough roadmap for its development? If the class is unstable to extend for some reason – what are the expected changes to come?
>
> Thanks!
>
> --
>
> Ostrzyciel
>
> _______________________________________________
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-leave@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/