import cx_Oracle
import time
import tqdm
import random
import string

username = 'sys'
password = 'toor'
database = 'localhost/XE'

try:
    start_time = time.perf_counter()
    with cx_Oracle.connect(username, password, database, encoding="UTF-8", mode=cx_Oracle.SYSDBA) as connection:
        cursor = connection.cursor()

        for idx in tqdm.tqdm(range(0, 1000000000), total=1000000000):
        # for idx in tqdm.tqdm(range(0, 5)):
            _strings = ""
            for idx in range(0, 7):
                _strings += random.choice(string.ascii_lowercase)
            sql = "insert into TEST values ('{}')".format(_strings)
            cursor.execute(sql)
            connection.commit()

        cursor.close()    
    print('done')
    print("{0:.2f}seconds".format(time.perf_counter() - start_time))

except cx_Oracle.Error as error:
    # Oracle Errors
    print(error)
except Exception as e:
    # Other Errors
    print(e)