Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P73476
(An Untitled Masterwork)
Active
Public
Actions
Authored by
Ladsgroup
on Feb 14 2025, 12:11 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Tags
None
Referenced Files
F58398640: raw-paste-data.txt
Feb 14 2025, 12:11 PM
2025-02-14 12:11:56 (UTC+0)
Subscribers
None
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
))
Event Timeline
Ladsgroup
created this paste.
Feb 14 2025, 12:11 PM
2025-02-14 12:11:56 (UTC+0)
Ladsgroup
mentioned this in
T386162: Some dewiktionary pageviews fatal "RevisionAccessException: Failed to load data blob from {address} for revision {revision}."
.
Feb 14 2025, 12:20 PM
2025-02-14 12:20:35 (UTC+0)
Log In to Comment