-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlConcurrencyTest.py
More file actions
62 lines (41 loc) · 1.14 KB
/
sqlConcurrencyTest.py
File metadata and controls
62 lines (41 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import MySQLdb
import sys
db = MySQLdb.connect("127.0.0.1", "root", "0007", "TESTDB")
cursor = db.cursor()
def iter_row(cursor, size=10):
while True:
rows = cursor.fetchmany(size)
if not rows:
break
for row in rows:
yield row
def crossProductTest():
query = "select * from tableB, tableA LIMIT 0, 150000"
try:
rows = cursor.execute(query)
for row in iter_row(cursor, 150000):
print(row)
# data = cursor.fetchall()
# statement = cursor.statement
counter = cursor.rowcount
print "Total %s rows got!" % counter
# print "The statement is: %s" % statement
print "Cross Product Test successfull"
except:
print "Error!!!"
print sys.exc_info()[0]
# for row in data:
# print row
def joinTest():
query = "select * from tableA join tableB"
rows = cursor.execute(query)
data = cursor.fetchall()
counter = cursor.rowcount
# for row in data:
# print row
return rowcount
crossProductTest()
# joinTest()
# print "Join Test successfull"
db.close()
print "Complete!"