Skip to content

Commit 2b7b19c

Browse files
committed
update query of articles_in_which_there_is_a_link_to_user_pages
1 parent 90818f3 commit 2b7b19c

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

tasks/statistics/articles_in_which_there_is_a_link_to_user_pages.py

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
from tasks.statistics.module import UpdatePage, ArticleTables, index
22

33
# Set the parameters for the update
4-
query = """select page.page_title as ll_page_title,pagelinks.pl_title as ll_page_to_title,pagelinks.pl_namespace as ll_pl_namespace
5-
from page
6-
inner join pagelinks
7-
on pagelinks.pl_from = page.page_id
8-
where pagelinks.pl_from_namespace = 0
9-
and (pagelinks.pl_namespace = 2 or pagelinks.pl_namespace = 3)
10-
and page.page_namespace = 0
11-
and page.page_is_redirect = 0
12-
and page.page_id not in (select templatelinks.tl_from from templatelinks
13-
join linktarget on linktarget.lt_id = templatelinks.tl_target_id
14-
where linktarget.lt_title in (select pl_title from pagelinks where pl_from = 9043549) and templatelinks.tl_from_namespace = 0 )
15-
and page.page_title not in (select pl_title from pagelinks where pl_from = 9043549);"""
4+
query = """SELECT page.page_title AS ll_page_title,
5+
linktarget.lt_title AS ll_page_to_title,
6+
linktarget.lt_namespace AS ll_pl_namespace
7+
FROM page
8+
INNER JOIN pagelinks ON pagelinks.pl_from = page.page_id
9+
inner join linktarget ON lt_id = pl_target_id
10+
WHERE pagelinks.pl_from_namespace = 0
11+
AND (linktarget.lt_namespace = 2
12+
OR linktarget.lt_namespace = 3)
13+
AND page.page_namespace = 0
14+
AND page.page_is_redirect = 0
15+
AND page.page_id not in
16+
(SELECT templatelinks.tl_from
17+
FROM templatelinks
18+
JOIN linktarget ON linktarget.lt_id = templatelinks.tl_target_id
19+
WHERE linktarget.lt_title in
20+
(SELECT lt_title
21+
FROM pagelinks
22+
inner join linktarget ON lt_id = pl_target_id
23+
WHERE pl_from = 9043549)
24+
AND templatelinks.tl_from_namespace = 0 )
25+
AND page.page_title not in
26+
(SELECT lt_title
27+
FROM pagelinks
28+
inner join linktarget ON lt_id = pl_target_id
29+
WHERE pl_from = 9043549
30+
);"""
1631
file_path = 'stub/articles_in_which_there_is_a_link_to_user_pages.txt'
1732
page_name = "ويكيبيديا:تقارير قاعدة البيانات/مقالات يوجد فيها وصلة إلى صفحات المستخدمين"
1833

0 commit comments

Comments
 (0)