Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
CommanderWaterford
.
Toggle Highlighting
SQL
report_title = settings.rootpage + 'Untagged biographies of living people' report_template = u''' Pages in [[:Category:Living people]] missing WikiProject tags (limited to \ the first 1000 entries); data as of <onlyinclude>%s</onlyinclude>. {| class="wikitable sortable plainlinks" style="width:100%%; margin:auto;" |- style="white-space:nowrap;" ! No. ! Biography |- %s |} ''' wiki = wikitools.Wiki(settings.apiurl) wiki.login(settings.username, settings.password) conn = MySQLdb.connect(host=settings.host, db=settings.dbname, read_default_file='~/.my.cnf') cursor = conn.cursor() cursor.execute(''' /* untaggedblps.py SLOW_OK */ SELECT p1.page_title FROM page AS p1 JOIN categorylinks ON cl_from = p1.page_id WHERE cl_to = 'Living_people' AND p1.page_namespace = 0 AND NOT EXISTS (SELECT 1 FROM page AS p2 WHERE p2.page_title = p1.page_title AND p2.page_namespace = 1) LIMIT 1000; ''') i = 1 output = [] for row in cursor.fetchall(): page_title = u'[[%s]]' % unicode(row[0], 'utf-8') table_row = u'''| %d | %s |-''' % (i, page_title) output.append(table_row) i += 1 cursor.execute('SELECT UNIX_TIMESTAMP() - UNIX_TIMESTAMP(rc_timestamp) FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1;') rep_lag = cursor.fetchone()[0] current_of = (datetime.datetime.utcnow() - datetime.timedelta(seconds=rep_lag)).strftime('%H:%M, %d %B %Y (UTC)') report = wikitools.Page(wiki, report_title) report_text = report_template % (current_of, '\n'.join(output)) report_text = report_text.encode('utf-8') report.edit(report_text, summary=settings.editsumm, bot=1) cursor.close() conn.close()
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...