summaryrefslogtreecommitdiff
path: root/view_meeting.py
blob: 5ec8dd0a77fcb873f3d6c18cdc29b323bc63980d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python3


import os
import sqlite3

db_path = "terminfinder_db.sqlite"

if not os.path.exists(db_path):
    print(f"DB named {db_path} does not exist!")
    exit(1)

con = sqlite3.connect(db_path)
cur = con.cursor()

meeting_id = "meet1"


def extract_meeting(meeting_id):
    # Data from meeting table
    select = cur.execute(f"SELECT * FROM meeting WHERE meeting_id = ?;", (meeting_id,))
    result = select.fetchone()
    meeting_data = {"meeting_id": meeting_id, "title": result[1],
                    "description": result[2],
                    "dates": result[3].split(",") if not result[3] is None else "",
                    "participants": result[4].split(",") if not result[4] is None else ""}

    # Individual dates data
    select = cur.execute(f"SELECT * FROM meeting_dates_{meeting_id};")
    result = select.fetchall()
    print(result)

    return meeting_data


meeting_data = extract_meeting(meeting_id)
print(meeting_data)