File size: 587 Bytes
997f52c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from storage.db import get_connection

def fetch_faculty_by_id(faculty_id: int):
    query = """

    SELECT

        faculty_id,

        name,

        faculty_category,

        image_url,

        education,

        phone,

        email,

        address

    FROM faculty

    WHERE faculty_id = ?

    """

    with get_connection() as conn:
        row = conn.execute(query, (faculty_id,)).fetchone()

    if row is None:
        return None

    return dict(row)