File size: 2,829 Bytes
3b48627
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import sqlite3
import uuid
import json
import streamlit as st
from utilities import (
    load_local_css,
    set_header,
    load_authenticator,
    send_email,
)
import streamlit_authenticator as stauth
import yaml
from yaml import SafeLoader



# st.set_page_config(layout="wide")
# load_local_css("styles.css")
# set_header()
# for k, v in st.session_state.items():
#     if k not in ["logout", "login", "config"] and not k.startswith(
#         "FormSubmitter"
#     ):
#         st.session_state[k] = v
# with open("config.yaml") as file:
#     config = yaml.load(file, Loader=SafeLoader)
#     st.session_state["config"] = config
# authenticator = stauth.Authenticate(
#     config["credentials"],
#     config["cookie"]["name"],
#     config["cookie"]["key"],
#     config["cookie"]["expiry_days"],
#     config["preauthorized"],
# )
# st.session_state["authenticator"] = authenticator
# name, authentication_status, username = authenticator.login("Login", "main")
# auth_status = st.session_state.get("authentication_status")
# if auth_status == True:
#     authenticator.logout("Logout", "main")
#     is_state_initiaized = st.session_state.get("initialized", False)
#     if not is_state_initiaized:
database_file = r'C:\Users\ManojP\Documents\Mastercard\Build\DB_Sample\DB\User.db'

conn = sqlite3.connect(database_file)
c = conn.cursor()


#c.execute('DROP TABLE  IF EXISTS users  ')
# c.execute('DROP TABLE  IF EXISTS sessions ')
# conn.commit()

#output = c.fetchall()

#st.write(output)

c.execute('''CREATE TABLE IF NOT EXISTS users

            (user_id INTEGER PRIMARY KEY,

            username TEXT,

            email TEXT,

            user_type TEXT )''')

c.execute('''CREATE TABLE IF NOT EXISTS sessions

            (user_id INTEGER,

             owner TEXT,

            session_id INTEGER,

            session_name TEXT,

            status TEXT,

            created_time TIMESTAMP,

            updated_time TIMESTAMP,

            allowed_users TEXT)''')

#c.execute("DELETE FROM sessions")


 
user_id = str(uuid.uuid4())




# c.executemany("INSERT INTO users (username, email,user_type) VALUES (?, ?,?)",
#         [("Geetha Krishna", "[email protected]","technical"),
#         ("Samkeet Sangai", "[email protected]","technical"),
#         ('Manoj P','[email protected]',"technical"),
#         ('Srishti Verma','[email protected]',"technical"),
#         ('Ismail mohammed',"[email protected]","technical"),
#         ('Sharon Sheng','[email protected]',"technical"),
#         ('Ioannis Papadopoulos','[email protected]',"business"),
#         ('Herman Kwong',"[email protected]",'technical'),

#         ])




conn.commit()