Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
7b5ebf32
Commit
7b5ebf32
authored
Jun 16, 2014
by
panos
Committed by
Jérome Perrin
Jun 17, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify the example to use the ConnectToDatabase object
parent
5245ca43
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
dream/KnowledgeExtraction/KEtool_examples/ParallelStations/ParallelStations_example.py
...ool_examples/ParallelStations/ParallelStations_example.py
+14
-7
No files found.
dream/KnowledgeExtraction/KEtool_examples/ParallelStations/ParallelStations_example.py
View file @
7b5ebf32
...
...
@@ -28,14 +28,21 @@ from DistributionFitting import Distributions
from
ExcelOutput
import
Output
import
pyodbc
import
json
import
ConnectToDatabase
#================================= Extract data from the database ==========================================#
cnxn
=
pyodbc
.
connect
(
"Driver={MySQL ODBC 3.51 Driver};SERVER=localhost; PORT=3306;DATABASE=test_database;UID=root; PASSWORD=Pitheos10;
"
)
cursor1
=
cnxn
.
cursor
()
cursor2
=
cnxn
.
cursor
()
cursor3
=
cnxn
.
cursor
()
# cnxn =pyodbc.connect("Driver={MySQL ODBC 3.51 Driver};SERVER=localhost; PORT=3306;DATABASE=test_database;UID=root; PASSWORD=Pitheos10;
")
#
cursor1 = cnxn.cursor()
# cursors[1]
= cnxn.cursor()
#
cursor3 = cnxn.cursor()
a
=
cursor1
.
execute
(
"""
cnxn
=
ConnectToDatabase
.
ConnectionData
(
seekName
=
'ServerData'
,
implicitExt
=
'txt'
,
number_of_cursors
=
3
)
cursors
=
cnxn
.
getCursors
()
print
cursors
a
=
cursors
[
0
].
execute
(
"""
select prod_code, stat_code,emp_no, TIMEIN, TIMEOUT
from production_status
"""
)
...
...
@@ -77,12 +84,12 @@ for elem in MILL2:
procTime_MILL2
.
append
(
dt
[
0
])
b
=
cursor
2
.
execute
(
"""
b
=
cursor
s
[
1
]
.
execute
(
"""
select stat_code, MTTF_hour
from failures
"""
)
c
=
cursor
3
.
execute
(
"""
c
=
cursor
s
[
2
]
.
execute
(
"""
select stat_code, MTTR_hour
from repairs
"""
)
...
...
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