Example #1
0
                    saveEpic(file_path, district.title(), cur)
                    db.commit()
                    deletePdf(file_path)


def deletePdf(file_path):
    os.remove(file_path)

def noOfFiles():
    nof = 0
    pdf_path = os.path.join('data', 'pdfs')
    districts = os.listdir(pdf_path)
    cwd = os.getcwd()
    for district in districts:
        district_path = os.path.join(cwd, pdf_path, district.title())
        assemblies = os.listdir(district_path)
        for assembly in assemblies:
            assembly_path = os.path.join(district_path, assembly.title())
            parts = os.listdir(assembly_path)
            for part in parts:
                file_path = os.path.join(assembly_path, part.title().lower())
                if os.path.isfile(file_path):
                    nof = nof + 1

    return nof


if __name__ == "__main__":
    db = db_conn.getConnection()
    cur = db_conn.getCursor(db)
    readPdfs(cur,db)
Example #2
0
import db_conn as db

conn = db.getConnection('compilers.db')

cursor = conn.cursor()

#############################################
#  GIT USERS
#############################################
cursor.execute("PRAGMA foreign_keys = 0")

cursor.execute("""DROP TABLE IF EXISTS test_result;""")
cursor.execute("""DROP TABLE IF EXISTS users;""")
cursor.execute("""DROP TABLE IF EXISTS repository;""")
cursor.execute("""DROP TABLE IF EXISTS version;""")

cursor.execute("""DROP VIEW IF EXISTS release_status;""")
cursor.execute("""DROP VIEW IF EXISTS test_result_status;""")

cursor.execute("PRAGMA foreign_keys = 1")

cursor.execute("""
CREATE TABLE users (
    git_username TEXT PRIMARY KEY NOT NULL,
    name TEXT NOT NULL,
    surname TEXT NOT NULL
);
""")

cursor.execute("""
CREATE TABLE repository (