I run regular SQL queries for unconnected pages on a few wikis via Pi bot, per:
https://bitbucket.org/mikepeel/wikicode/src/master/query_enwp_articles_no_wikidata.py
Specifically by running this query:
SELECT page_title FROM page WHERE page_namespace=0 AND page_is_redirect=0 AND page_id NOT IN (SELECT page_id FROM page JOIN page_props ON page_id=pp_page WHERE page_namespace=0 AND pp_propname='wikibase_item')
I recently learnt that EXPECTED_UNCONNECTED_PAGE exists as a magic word, seemingly introduced by T97577.
I would like to exclude pages that use this magic word from the database query, so that the bot runs more optimally - is this possible somehow?