Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F58398640
raw-paste-data.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
Ladsgroup
Feb 14 2025, 12:11 PM
2025-02-14 12:11:56 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw-paste-data.txt
View Options
import pymysql.cursors
import json
import time
replica_db = 'dbstore1007.eqiad.wmnet'
replica_db_port = 3313
db_name = 'dewiktionary'
#section_master = 'db1163.eqiad.wmnet'
#connection_to_master = pymysql.connect(
# host=section_master,
# port=3306,
# read_default_file='/root/.my.cnf',
# database=db_name,
# cursorclass=pymysql.cursors.DictCursor)
with open('dewiktionary', 'r') as f:
oldids = f.read().split('\n')
mapping = {}
for oldid in oldids:
oldid = oldid.strip()
if not oldid:
continue
content_ids = []
connection_to_replica = pymysql.connect(
host=replica_db,
port=replica_db_port,
read_default_file='/root/.my.cnf',
database=db_name,
cursorclass=pymysql.cursors.DictCursor)
with connection_to_replica:
with connection_to_replica.cursor() as cursor:
cursor.execute( f'select content_id from content where content_address = \'{oldid}\';')
result = cursor.fetchall()
for row in result:
content_ids.append(row['content_id'])
if not content_ids:
continue
mapping[oldid] = content_ids
time.sleep(.1)
with open('dewiktionary_mapping', 'w') as f:
f.write(json.dumps(mapping))
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
19261503
Default Alt Text
raw-paste-data.txt (1 KB)
Attached To
Mode
P73476 (An Untitled Masterwork)
Attached
Detach File
Event Timeline
Log In to Comment