2018-09-02 22:40:32 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
import mysql.connector as mariadb
|
2018-09-03 22:44:58 +02:00
|
|
|
import time
|
2018-09-02 22:40:32 +02:00
|
|
|
|
|
|
|
mariadb_connection = mariadb.connect(user='vagrant',
|
|
|
|
database='testdb')
|
|
|
|
cursor = mariadb_connection.cursor()
|
|
|
|
|
2018-09-03 22:44:58 +02:00
|
|
|
allowed_query = ("select username, hobby from user;")
|
2018-09-02 22:40:32 +02:00
|
|
|
|
2018-09-03 22:44:58 +02:00
|
|
|
print()
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
start_time = time.time()
|
|
|
|
cursor.execute(allowed_query)
|
2018-09-02 22:40:32 +02:00
|
|
|
data = cursor.fetchall()
|
2018-09-03 22:44:58 +02:00
|
|
|
print("--- %s seconds ---" % (time.time() - start_time))
|
|
|
|
print(len(data))
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
print()
|
|
|
|
|