Nova Resource:Tools.tsreports/Converting queries
Converting TSReports queries to Quarry, in 7 steps:
- Open the TSReports page you want to convert. This example will use https://tools.wmflabs.org/tsreports/?wiki=nlwiki&report=mostlinked (Most linked-to pages - https://nl.wikipedia.org)
- In the git repository, open the report template with the same name, which you can find in the URL:
report=mostlinked
. Copy the content between %query and %end. In this case:SELECT pl_namespace, pl_title, COUNT(*) AS nlinks FROM pagelinks GROUP BY pl_namespace, pl_title ORDER BY nlinks DESC LIMIT 1000
- Open Quarry and log in with your Wikimedia username.
- Click on 'New Query'
- In the SQL field, type
use <wiki>_p;
, where wiki comes from the URL:wiki=nlwiki
. On the next line, copy in the query. In this case:use nlwiki_p; SELECT pl_namespace, pl_title, COUNT(*) AS nlinks FROM pagelinks GROUP BY pl_namespace, pl_title ORDER BY nlinks DESC LIMIT 1000
- Click 'Submit query'
- After some time, the result of the query will appear.
Bonus: creating wikilinks from namespace and title. Rewrite the above to read
CONCAT('[[{{ns:', pl_namespace, '}}:', pl_title, ']]') as pagelink
The wikitable export will now generate clickable wikilinks.