Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate models and schemas to SQLModels #136

Closed
JeremyEastham opened this issue Jun 22, 2023 · 3 comments
Closed

Migrate models and schemas to SQLModels #136

JeremyEastham opened this issue Jun 22, 2023 · 3 comments
Labels
backend Deals with the FastAPI and web-scraping backend enhancement Adds value to a previous feature refactor Improve code without changing functionality

Comments

@JeremyEastham
Copy link
Collaborator

SQLModel is a library written by the creator of FastAPI that streamlines the process of working with SQLAlchemy models and Pydantic models. Currently our code contains both an internship model (SQLAlchemy model) and an internship schema (Pydantic model). It also contains functions to convert between the two, which have been the source of bugs (year and period issues).

SQLModel adds a class called SQLModel that is both a SQLAlchemy model and a Pydantic model. This eliminates the need for duplicate models/schemas and functions to convert between the two. This will become especially important when we add more database tables for users, tags, companies, etc.

Migration should be relatively straightforward. The most difficult part will be removing the conversion functions and seeing what breaks. Hopefully, we should be able to just ignore conversion and continue.

@johndpjr johndpjr added this to AgTern Sep 28, 2023
@github-project-automation github-project-automation bot moved this to Backlog in AgTern Sep 28, 2023
@johndpjr johndpjr added enhancement Adds value to a previous feature backend Deals with the FastAPI and web-scraping backend labels Sep 28, 2023
@johndpjr johndpjr moved this from Backlog to Todo in AgTern Oct 3, 2023
@johndpjr johndpjr added this to the Sprint 1 milestone Oct 3, 2023
@johndpjr
Copy link
Owner

johndpjr commented Oct 3, 2023

Context

@Oshruti see above for context and below for some actionable steps. LMK if you need help / more detail.

TODO

  • Merge the models and schemas folders into one folder named models
  • Change import paths to support new project structure and migrate all current usages of models and schemas to support this new SQLModel (if any migration is needed)

Notes

This may not be possible to complete this sprint, but do your best!

@johndpjr
Copy link
Owner

johndpjr commented Oct 3, 2023

Due to some versioning issues seen below, it seems that implementing this right now is not best. We were already planning on upgrading Pydantic and SQLAlchemy. I'll reopen this when SQLModel gets updated (which I heard on the internet that an update was planned). @Oshruti I'll find another issue for you to work this week

# sqlmodel/pyproject.toml
[tool.poetry.dependencies]
python = "^3.7"
SQLAlchemy = ">=1.4.17,<=1.4.41"
pydantic = "^1.8.2"
sqlalchemy2-stubs = {version = "*", allow-prereleases = true}

@johndpjr johndpjr closed this as not planned Won't fix, can't repro, duplicate, stale Oct 3, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in AgTern Oct 3, 2023
@JeremyEastham
Copy link
Collaborator Author

SQLModel has gained support for our currently outdated versions of Pydantic and SQLAlchemy (See roadmap). It should be discussed whether we should migrate to SQLModel before we migrate Pydantic and SQLAlchemy. The roadmap has no timeline, so we should evaluate which dependency update would add the most value to our project.

@JeremyEastham JeremyEastham reopened this Nov 8, 2023
@github-project-automation github-project-automation bot moved this from Done to Todo in AgTern Nov 8, 2023
@johndpjr johndpjr modified the milestones: Sprint 1, 2024 Spring Semester Mar 13, 2024
@johndpjr johndpjr moved this from Todo to Backlog in AgTern Mar 13, 2024
@johndpjr johndpjr added the waiting Waiting for something to happen label Mar 14, 2024
@johndpjr johndpjr removed this from the 2024 Spring Semester milestone Sep 9, 2024
@johndpjr johndpjr added refactor Improve code without changing functionality and removed waiting Waiting for something to happen labels Sep 13, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in AgTern Sep 14, 2024
@johndpjr johndpjr added this to the 2024 Fall Semester milestone Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Deals with the FastAPI and web-scraping backend enhancement Adds value to a previous feature refactor Improve code without changing functionality
Projects
Status: Done
Development

No branches or pull requests

3 participants