File size: 478 Bytes
ced1295
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from __future__ import annotations

from sqlite3 import Connection


def find_user_by_email(conn: Connection, email: str):
    return conn.execute("SELECT id, email, display_name FROM users WHERE email = ?", (email,)).fetchone()


def insert_user(conn: Connection, email: str, display_name: str):
    conn.execute(
        "INSERT INTO users (email, display_name) VALUES (?, ?)",
        (email, display_name),
    )
    conn.commit()
    return find_user_by_email(conn, email)