File size: 1,255 Bytes
fb95c43
 
 
 
 
d7a243c
 
fdb6484
d7a243c
 
 
 
 
 
 
 
fdb6484
 
d7a243c
fb95c43
 
 
 
 
 
 
fdb6484
 
fb95c43
d7a243c
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
from sqlmodel import SQLModel, Field
from typing import Optional
import datetime

class Sources(SQLModel, table=True):
    """
    Database schema for the Sources table.

    Attributes:
        id (Optional[int]): The primary key for the table.
        url (str): The URL of the source.
        title (Optional[str]): The title of the source.
        hash_id (str): A unique identifier for the source.
        created_at (float): Timestamp indicating when the entry was created.
        summary (str): A summary of the source content.
        embedded (bool): Flag indicating whether the source is embedded.
        session_id (str): A unique identifier for the session when the entry was added.
        session_date_time (str): The timestamp when the session was created.
    """
    id: Optional[int] = Field(default=None, primary_key=True)
    url: str = Field()
    title: Optional[str] = Field(default="NA", unique=False)
    hash_id: str = Field(unique=True)
    created_at: float = Field(default=datetime.datetime.now().timestamp())
    summary: str = Field(default="")
    embedded: bool = Field(default=False)
    session_id: str = Field(default="")
    session_date_time: str = Field(default="")

    __table_args__ = {"extend_existing": True}