connect.py 590 Bytes
import cx_Oracle
import os
from config.key import DATABASE_ID, DATABASE_PW
from config.URLs import DATABASE_URL


def connectDB():
    connection = cx_Oracle.connect(DATABASE_ID, DATABASE_PW, DATABASE_URL)

    global cursor

    cursor = connection.cursor()
    print('my')
    print(cursor)
    cursor.execute("""
        select * from users where user_id=\'__tester__\'
    """)

    res = cursor.fetchall()
    print(res)
    print('my')

    return cursor


def closeDB():
    cursor.close()


def queryDB(query):
    cursor.execute(query)

    res = cursor.fetchall()

    return res