summaryrefslogtreecommitdiff
path: root/python/database.py
blob: 5bc8b5fc9c5361ea45dab2f92107560931253f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import mysql.connector


def getConnector():
    return mysql.connector.connect(
        host="localhost",
        user="root",
    )


def getCursor(connector):
    return connector.cursor()


def runQuery(connector, query):
    cursor = getCursor(connector)
    cursor.execute(query)
    result = cursor.fetchall()
    cursor.close()
    return result