Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david Chavalarias
clinicaltrials
Commits
ac885b90
Commit
ac885b90
authored
Mar 21, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dbdatapi: extract loop replaced by WHERE..IN (25 x faster)
parent
07eeea46
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
56 deletions
+55
-56
dbdatapi.py
services/dbdatapi.py
+55
-56
No files found.
services/dbdatapi.py
View file @
ac885b90
...
@@ -585,8 +585,7 @@ class BipartiteExtractor:
...
@@ -585,8 +585,7 @@ class BipartiteExtractor:
# mlog("DEBUG", "MySQL extract scholar_array:", scholar_array)
# mlog("DEBUG", "MySQL extract scholar_array:", scholar_array)
# scholar_array = list(scholar_array.keys())[0:3]
# scholar_array = list(scholar_array.keys())[0:3]
# TODO loop could be after SELECT
for
scholar_id
in
scholar_array
:
sql3
=
'''
sql3
=
'''
SELECT
SELECT
scholars_and_orgs.*,
scholars_and_orgs.*,
...
@@ -627,16 +626,17 @@ class BipartiteExtractor:
...
@@ -627,16 +626,17 @@ class BipartiteExtractor:
ON sch_kw.uid = scholars_and_orgs.luid
ON sch_kw.uid = scholars_and_orgs.luid
LEFT JOIN keywords
LEFT JOIN keywords
ON sch_kw.kwid = keywords.kwid
ON sch_kw.kwid = keywords.kwid
WHERE luid =
%
s
WHERE luid IN
%
s
GROUP BY luid ;
GROUP BY luid ;
'''
%
scholar_id
'''
%
(
'('
+
','
.
join
(
map
(
str
,
list
(
scholar_array
.
keys
())))
+
')'
)
# debug
# debug
#
mlog("DEBUG", "db.extract: sql3="+sql3)
mlog
(
"DEBUG"
,
"db.extract: sql3="
+
sql3
)
try
:
try
:
self
.
cursor
.
execute
(
sql3
)
self
.
cursor
.
execute
(
sql3
)
res3
=
self
.
cursor
.
fetchone
()
for
res3
in
self
.
cursor
:
info
=
{};
info
=
{};
# semantic short ID
# semantic short ID
...
@@ -706,7 +706,6 @@ class BipartiteExtractor:
...
@@ -706,7 +706,6 @@ class BipartiteExtractor:
mlog
(
"ERROR"
,
"===== /extract ERROR ===="
)
mlog
(
"ERROR"
,
"===== /extract ERROR ===="
)
# génère le gexf
# génère le gexf
# include('gexf_generator.php');
# include('gexf_generator.php');
imsize
=
80
;
imsize
=
80
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment