-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
49 lines (38 loc) · 1.15 KB
/
main.py
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
import csv
import mysql.connector
from mysql.connector.constants import ClientFlag
config = {
'user': 'root',
'password': '23bodIf3FyslAkbM',
'host': '35.192.1.42',
'client_flags': [ClientFlag.SSL],
'ssl_ca': 'server-ca.pem',
'ssl_cert': 'client-cert.pem',
'ssl_key': 'client-key.pem'
}
config['database'] = 'ensoccerpedia'
# now we establish our connection
cnxn = mysql.connector.connect(**config)
cursor = cnxn.cursor(buffered=True) # initialize connection cursor
season = input("Please enter the season year (i.e. for 2018-19 season enter 2018): ")
home = input("Please enter the home team: ")
away = input("Please enter the away team: ")
cursor.execute("""
SELECT * FROM engsoccerdata
WHERE Home = %s
AND Visitor = %s
AND Season = %s""", (home, away, season))
for row in cursor:
date = row[0]
home = row[2]
visitor = row[3]
hgoal = row[5]
agoal = row[6]
print("Game Info: ")
print("Date: " + date)
print("Teams: " + home + " - " + visitor)
print("Result: " + str(hgoal) + "-" + str(agoal))
cursor.close()
cursor = cnxn.cursor(buffered=True)
cnxn.commit()
cnxn.close()