Page MenuHomePhabricator
Paste P16829

(An Untitled Masterwork)
ActivePublic

Authored by Urbanecm_WMF on Fri, Jul 16, 4:36 PM.
from wmfdata import mariadb
import pandas as pd
def get_dblist(dblist):
f = open('/srv/mediawiki-config/dblists/%s.dblist' % dblist)
res = f.read().split('\n')
f.close()
res.pop(0)
res.pop()
return res
dfs = []
wikis = get_dblist('growthexperiments')
for wiki in wikis:
df = mariadb.run('''
SELECT
DATABASE() AS dbname,
COUNT(*) AS mentees
FROM growthexperiments_mentor_mentee
''', wiki, use_x1=True)
df.set_index('dbname', inplace=True)
dfs.append(df)
df = pd.concat(dfs)