Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Imène Lajili
clowdflows
Commits
b89e2c26
Commit
b89e2c26
authored
Feb 07, 2013
by
bogdan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of workflow.ijs.si:mothra into searchFunct
parents
7dd33198
db580e10
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
346 additions
and
320 deletions
+346
-320
workflows/mysql/context.py
workflows/mysql/context.py
+15
-5
workflows/mysql/db/package_data.json
workflows/mysql/db/package_data.json
+328
-310
workflows/mysql/interaction_views.py
workflows/mysql/interaction_views.py
+3
-3
workflows/mysql/templates/interactions/db_context.html
workflows/mysql/templates/interactions/db_context.html
+0
-2
No files found.
workflows/mysql/context.py
View file @
b89e2c26
...
...
@@ -24,7 +24,7 @@ class DBConnection:
return
sql
.
connect
(
user
=
self
.
user
,
password
=
self
.
password
,
host
=
self
.
host
,
database
=
self
.
database
)
class
DBContext
:
def
__init__
(
self
,
connection
):
def
__init__
(
self
,
connection
,
find_connections
=
False
):
'''
Initializes the fields:
tables: list of selected tables
...
...
@@ -36,7 +36,6 @@ class DBContext:
pkeys: private key for a given table
target_table: selected table for learning
target_att: selected column for learning
target_att_val: selected target att value
'''
self
.
connection
=
connection
con
=
connection
.
connect
()
...
...
@@ -54,18 +53,27 @@ class DBContext:
for
col
in
cols
:
cursor
.
execute
(
"SELECT DISTINCT `%s` FROM `%s` LIMIT 51"
%
(
col
,
table
))
self
.
col_vals
[
table
][
col
]
=
[
val
for
(
val
,)
in
cursor
]
print
self
.
col_vals
self
.
connected
=
{}
cursor
.
execute
(
"SELECT table_name, column_name, referenced_table_name, referenced_column_name
\
FROM information_schema.KEY_COLUMN_USAGE
\
WHERE referenced_table_name IS NOT NULL AND table_schema='%s'"
%
connection
.
database
)
self
.
fkeys
=
defaultdict
(
set
)
self
.
pkeys
=
{}
if
find_connections
:
for
table
in
self
.
tables
:
for
col
in
self
.
cols
[
table
]:
if
col
.
endswith
(
'_id'
):
ref_table
=
(
col
[:
-
4
]
+
'ies'
)
if
col
[
-
4
]
==
'y'
else
(
col
[:
-
3
]
+
's'
)
self
.
connected
[(
table
,
ref_table
)]
=
(
col
,
'id'
)
self
.
connected
[(
ref_table
,
table
)]
=
(
'id'
,
col
)
self
.
fkeys
[
table
].
add
(
col
)
if
col
==
'id'
:
self
.
pkeys
[
table
]
=
col
for
(
table
,
col
,
ref_table
,
ref_col
)
in
cursor
:
self
.
connected
[(
table
,
ref_table
)]
=
(
col
,
ref_col
)
self
.
connected
[(
ref_table
,
table
)]
=
(
ref_col
,
col
)
self
.
fkeys
[
table
].
add
(
col
)
self
.
pkeys
=
{}
cursor
.
execute
(
"SELECT table_name, column_name
\
FROM information_schema.KEY_COLUMN_USAGE
\
...
...
@@ -126,5 +134,7 @@ class DBContext:
return
types
def
__repr__
(
self
):
return
str
((
self
.
target_table
,
self
.
target_att
,
self
.
tables
,
self
.
cols
,
self
.
connected
))
#import pprint
#return pprint.pformat((self.target_table, self.target_att, self.tables, self.cols, self.connected, self.pkeys, self.fkeys))
return
'fkeys : '
+
str
(
self
.
fkeys
)
workflows/mysql/db/package_data.json
View file @
b89e2c26
[
{
"pk"
:
39
,
"model"
:
"workflows.category"
,
"pk"
:
20
,
"model"
:
"workflows.category"
,
"fields"
:
{
"uid"
:
"b66b71b1-99d6-4efc-b264-a914a3e42911"
,
"parent"
:
null
,
"workflow"
:
null
,
"user"
:
null
,
"order"
:
1
,
"uid"
:
"b66b71b1-99d6-4efc-b264-a914a3e42911"
,
"parent"
:
null
,
"workflow"
:
null
,
"user"
:
null
,
"order"
:
1
,
"name"
:
"MySQL"
}
},
},
{
"pk"
:
1
90
,
"model"
:
"workflows.abstractwidget"
,
"pk"
:
1
04
,
"model"
:
"workflows.abstractwidget"
,
"fields"
:
{
"category"
:
39
,
"treeview_image"
:
""
,
"name"
:
"Database Context"
,
"is_streaming"
:
false
,
"uid"
:
"649015ac-ca53-43bc-a36a-c603b52f8775"
,
"interaction_view"
:
"mysql_db_context"
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
"mysql_db_context_finished"
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_db_context"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
true
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"category"
:
20
,
"treeview_image"
:
""
,
"name"
:
"Database Context"
,
"is_streaming"
:
false
,
"uid"
:
"649015ac-ca53-43bc-a36a-c603b52f8775"
,
"interaction_view"
:
"mysql_db_context"
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
"mysql_db_context_finished"
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_db_context"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
true
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"description"
:
""
}
},
},
{
"pk"
:
443
,
"model"
:
"workflows.abstractinput"
,
"pk"
:
213
,
"model"
:
"workflows.abstractinput"
,
"fields"
:
{
"widget"
:
1
90
,
"name"
:
"connection"
,
"short_name"
:
"con"
,
"uid"
:
"6c23b4a2-a18e-498e-a22c-4de86932da3e"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"connection"
,
"parameter"
:
false
,
"order"
:
1
,
"widget"
:
1
04
,
"name"
:
"connection"
,
"short_name"
:
"con"
,
"uid"
:
"6c23b4a2-a18e-498e-a22c-4de86932da3e"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"connection"
,
"parameter"
:
false
,
"order"
:
1
,
"description"
:
""
}
},
},
{
"pk"
:
2
16
,
"model"
:
"workflows.abstract
output"
,
"pk"
:
2
36
,
"model"
:
"workflows.abstract
input"
,
"fields"
:
{
"widget"
:
190
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"variable"
:
"context"
,
"uid"
:
"171aa481-0f93-4315-a476-ed3b0aa8c9e4"
,
"order"
:
1
,
"widget"
:
104
,
"name"
:
"Table connection from names"
,
"short_name"
:
"tbc"
,
"uid"
:
"be3718eb-062e-48f2-af2a-8c31e66524fe"
,
"default"
:
"false"
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
"checkbox"
,
"variable"
:
"find_connections"
,
"parameter"
:
true
,
"order"
:
1
,
"description"
:
"Tries to detect connections between tables solely by looking at the attribute names."
}
},
{
"pk"
:
117
,
"model"
:
"workflows.abstractoutput"
,
"fields"
:
{
"widget"
:
104
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"variable"
:
"context"
,
"uid"
:
"171aa481-0f93-4315-a476-ed3b0aa8c9e4"
,
"order"
:
1
,
"description"
:
""
}
},
},
{
"pk"
:
1
91
,
"model"
:
"workflows.abstractwidget"
,
"pk"
:
1
05
,
"model"
:
"workflows.abstractwidget"
,
"fields"
:
{
"category"
:
39
,
"treeview_image"
:
""
,
"name"
:
"Database To Aleph"
,
"is_streaming"
:
false
,
"uid"
:
"3c5ac714-84ca-4c93-befb-ce0c16148193"
,
"interaction_view"
:
""
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
""
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_aleph_converter"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
false
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"category"
:
20
,
"treeview_image"
:
""
,
"name"
:
"Database To Aleph"
,
"is_streaming"
:
false
,
"uid"
:
"3c5ac714-84ca-4c93-befb-ce0c16148193"
,
"interaction_view"
:
""
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
""
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_aleph_converter"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
false
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"description"
:
""
}
},
},
{
"pk"
:
451
,
"model"
:
"workflows.abstractinput"
,
"pk"
:
235
,
"model"
:
"workflows.abstractinput"
,
"fields"
:
{
"widget"
:
1
91
,
"name"
:
"Target attribute value"
,
"short_name"
:
"tgt"
,
"uid"
:
"5b7354f1-35d8-41c8-a0ae-c3848855f29d"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
"text"
,
"variable"
:
"target_att_val"
,
"parameter"
:
true
,
"order"
:
1
,
"widget"
:
1
05
,
"name"
:
"Target attribute value"
,
"short_name"
:
"tgt"
,
"uid"
:
"5b7354f1-35d8-41c8-a0ae-c3848855f29d"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
"text"
,
"variable"
:
"target_att_val"
,
"parameter"
:
true
,
"order"
:
1
,
"description"
:
"Target attribute value to be used as the positive class"
}
},
},
{
"pk"
:
444
,
"model"
:
"workflows.abstractinput"
,
"pk"
:
214
,
"model"
:
"workflows.abstractinput"
,
"fields"
:
{
"widget"
:
1
91
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"uid"
:
"474e9673-9c55-48c5-bae8-a7b986aa0287"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"context"
,
"parameter"
:
false
,
"order"
:
2
,
"widget"
:
1
05
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"uid"
:
"474e9673-9c55-48c5-bae8-a7b986aa0287"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"context"
,
"parameter"
:
false
,
"order"
:
2
,
"description"
:
"Database context object"
}
},
},
{
"pk"
:
217
,
"model"
:
"workflows.abstractoutput"
,
"pk"
:
118
,
"model"
:
"workflows.abstractoutput"
,
"fields"
:
{
"widget"
:
1
91
,
"name"
:
"pos_examples"
,
"short_name"
:
"pex"
,
"variable"
:
"pos_examples"
,
"uid"
:
"48184527-16a5-446c-9181-48a6558430c2"
,
"order"
:
2
,
"widget"
:
1
05
,
"name"
:
"pos_examples"
,
"short_name"
:
"pex"
,
"variable"
:
"pos_examples"
,
"uid"
:
"48184527-16a5-446c-9181-48a6558430c2"
,
"order"
:
2
,
"description"
:
"positive examples file"
}
},
},
{
"pk"
:
218
,
"model"
:
"workflows.abstractoutput"
,
"pk"
:
119
,
"model"
:
"workflows.abstractoutput"
,
"fields"
:
{
"widget"
:
1
91
,
"name"
:
"neg_examples"
,
"short_name"
:
"nex"
,
"variable"
:
"neg_examples"
,
"uid"
:
"2c623064-95cd-48ac-8bff-617edf2b9468"
,
"order"
:
3
,
"widget"
:
1
05
,
"name"
:
"neg_examples"
,
"short_name"
:
"nex"
,
"variable"
:
"neg_examples"
,
"uid"
:
"2c623064-95cd-48ac-8bff-617edf2b9468"
,
"order"
:
3
,
"description"
:
"negative examples file"
}
},
},
{
"pk"
:
219
,
"model"
:
"workflows.abstractoutput"
,
"pk"
:
120
,
"model"
:
"workflows.abstractoutput"
,
"fields"
:
{
"widget"
:
1
91
,
"name"
:
"bk"
,
"short_name"
:
"bk"
,
"variable"
:
"bk"
,
"uid"
:
"5e61e44e-cc52-4471-9a41-3afa52f58ab1"
,
"order"
:
4
,
"widget"
:
1
05
,
"name"
:
"bk"
,
"short_name"
:
"bk"
,
"variable"
:
"bk"
,
"uid"
:
"5e61e44e-cc52-4471-9a41-3afa52f58ab1"
,
"order"
:
4
,
"description"
:
"background knowledge"
}
},
},
{
"pk"
:
1
92
,
"model"
:
"workflows.abstractwidget"
,
"pk"
:
1
06
,
"model"
:
"workflows.abstractwidget"
,
"fields"
:
{
"category"
:
39
,
"treeview_image"
:
""
,
"name"
:
"Database To Orange Table"
,
"is_streaming"
:
false
,
"uid"
:
"baa32a60-5acb-42a1-ba83-23a6ab2160e7"
,
"interaction_view"
:
"mysql_orange_converter"
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
"mysql_orange_converter_finished"
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_orange_converter"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
false
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"category"
:
20
,
"treeview_image"
:
""
,
"name"
:
"Database To Orange Table"
,
"is_streaming"
:
false
,
"uid"
:
"baa32a60-5acb-42a1-ba83-23a6ab2160e7"
,
"interaction_view"
:
"mysql_orange_converter"
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
"mysql_orange_converter_finished"
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_orange_converter"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
false
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"description"
:
""
}
},
},
{
"pk"
:
445
,
"model"
:
"workflows.abstractinput"
,
"pk"
:
215
,
"model"
:
"workflows.abstractinput"
,
"fields"
:
{
"widget"
:
1
92
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"uid"
:
"1f9b5ccf-65c3-4ccc-818e-afb3a6ffee20"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"context"
,
"parameter"
:
false
,
"order"
:
1
,
"widget"
:
1
06
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"uid"
:
"1f9b5ccf-65c3-4ccc-818e-afb3a6ffee20"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"context"
,
"parameter"
:
false
,
"order"
:
1
,
"description"
:
"Database context object"
}
},
},
{
"pk"
:
220
,
"model"
:
"workflows.abstractoutput"
,
"pk"
:
121
,
"model"
:
"workflows.abstractoutput"
,
"fields"
:
{
"widget"
:
1
92
,
"name"
:
"Data table"
,
"short_name"
:
"odt"
,
"variable"
:
"dataset"
,
"uid"
:
"8dc434fd-3307-432f-b1d7-74638390a077"
,
"order"
:
1
,
"widget"
:
1
06
,
"name"
:
"Data table"
,
"short_name"
:
"odt"
,
"variable"
:
"dataset"
,
"uid"
:
"8dc434fd-3307-432f-b1d7-74638390a077"
,
"order"
:
1
,
"description"
:
"Orange data table"
}
},
},
{
"pk"
:
1
93
,
"model"
:
"workflows.abstractwidget"
,
"pk"
:
1
07
,
"model"
:
"workflows.abstractwidget"
,
"fields"
:
{
"category"
:
39
,
"treeview_image"
:
""
,
"name"
:
"Database To RSD"
,
"is_streaming"
:
false
,
"uid"
:
"e5b68e38-cb53-408a-a58f-26742d6ecb3c"
,
"interaction_view"
:
""
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
""
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_rsd_converter"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
false
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"category"
:
20
,
"treeview_image"
:
""
,
"name"
:
"Database To RSD"
,
"is_streaming"
:
false
,
"uid"
:
"e5b68e38-cb53-408a-a58f-26742d6ecb3c"
,
"interaction_view"
:
""
,
"image"
:
""
,
"package"
:
"mysql"
,
"static_image"
:
"mysql.png"
,
"post_interact_action"
:
""
,
"user"
:
null
,
"visualization_view"
:
""
,
"action"
:
"mysql_rsd_converter"
,
"wsdl_method"
:
""
,
"wsdl"
:
""
,
"interactive"
:
false
,
"has_progress_bar"
:
false
,
"order"
:
1
,
"description"
:
""
}
},
},
{
"pk"
:
446
,
"model"
:
"workflows.abstractinput"
,
"pk"
:
216
,
"model"
:
"workflows.abstractinput"
,
"fields"
:
{
"widget"
:
1
93
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"uid"
:
"4f1397a8-4e72-4b34-b31d-d09bf9a7e7d9"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"context"
,
"parameter"
:
false
,
"order"
:
1
,
"widget"
:
1
07
,
"name"
:
"context"
,
"short_name"
:
"cxt"
,
"uid"
:
"4f1397a8-4e72-4b34-b31d-d09bf9a7e7d9"
,
"default"
:
""
,
"required"
:
true
,
"multi"
:
false
,
"parameter_type"
:
null
,
"variable"
:
"context"
,
"parameter"
:
false
,
"order"
:
1
,
"description"
:
"Database context object"
}
},
},
{
"pk"
:
221
,
"model"
:
"workflows.abstractoutput"
,
"pk"
:
122
,
"model"
:
"workflows.abstractoutput"
,
"fields"
:
{
"widget"
:
1
93
,
"name"
:
"examples"
,
"short_name"
:
"exm"
,
"variable"
:
"examples"
,
"uid"
:
"f17690db-636b-4874-8406-f57778550c27"
,
"order"
:
1
,
"widget"
:
1
07
,
"name"
:
"examples"
,
"short_name"
:
"exm"
,
"variable"
:
"examples"
,
"uid"
:
"f17690db-636b-4874-8406-f57778550c27"
,
"order"
:
1
,
"description"
:
"examples"
}
},
},
{
"pk"
:
222
,
"model"
:
"workflows.abstractoutput"
,
"pk"
:
123
,
"model"
:
"workflows.abstractoutput"
,
"fields"
:
{
"widget"
:
1
93
,
"name"
:
"bk"
,
"short_name"
:
"bk"
,
"variable"
:
"bk"
,
"uid"
:
"89a386ef-3aa8-441f-99ff-4b64b1e3357f"
,
"order"
:
2
,
"widget"
:
1
07
,
"name"
:
"bk"
,
"short_name"
:
"bk"
,
"variable"
:
"bk"
,
"uid"
:
"89a386ef-3aa8-441f-99ff-4b64b1e3357f"
,
"order"
:
2
,
"description"
:
"background knowledge"
}
},
},