-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split event population and vector db population
- Loading branch information
Showing
2 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from src.common.database import engine | ||
from sqlalchemy.orm import Session | ||
from sqlalchemy import select | ||
from src.events.models import Analysis | ||
|
||
|
||
def get_analyses(): | ||
with Session(engine) as session: | ||
# Select the first 5 articles | ||
result = session.scalars(select(Analysis).limit(5)) | ||
|
||
analyses = [] | ||
# Iterate over the result and print each article | ||
for article in result: | ||
data_dict = { | ||
"id": article.id, | ||
"event_id": article.event_id, | ||
"category_id": article.category_id, | ||
"content": article.content, | ||
} | ||
analyses.append(data_dict) | ||
|
||
return analyses | ||
|
||
|
||
if __name__ == "__main__": | ||
print(len(get_analyses())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters