Exemplo n.º 1
0
class Team(object):
    def __init__(self, teamName):
        self.teamName = teamName
        self.databaseName = 'data/' + make_safe_name(
            self.teamName) + '.sqlite3'
        self.entries = Entries()

        if not os.path.exists(self.databaseName):
            with self.dbConnect() as connection:
                self.entries.createTable(connection)

        with self.dbConnect() as connection:
            data = connection.execute("PRAGMA schema_version").fetchone()
            if data[0] != self.entries.SCHEMA_VERSION:
                self.entries.migrate(connection, data[0])

    def dbConnect(self):
        return sqlite3.connect(self.databaseName,
                               detect_types=sqlite3.PARSE_DECLTYPES)
Exemplo n.º 2
0
    try:
        os.remove(DB_STRING)
    except IOError:
        pass  #delete File, if it doesn't exist we don't care

    with sqlite3.connect(DB_STRING) as connection:
        tasks = Tasks()
        members = Members()
        entries = Entries()
        smugmugConfig = json.load(open('secrets.json', 'r'))

        #Create the Tables
        tasks.createTable(connection)
        members.createTable(connection)
        entries.createTable(connection)

        #Initate our Members Table
        membersList = [
            "Andrew Vo", "Chirag Sreedhara", "Eric Wong", "Evan Spiering",
            "Izaak Kreykes", "Nithya Golla", "Philip Smith",
            "Preeti Thirukonda", "Rishi Maroju"
        ]
        members.insertMembers(connection, membersList)

        # #Pull the Tasks over
        # taskList = yaml.safe_load(open("data/tasks.yaml"))
        # for task in taskList:
        #     tasks.addTask(connection, task['name'], textToStage(task['stage']))

        #flip the Entries