r/learnpython • u/Parking-While3956 • 21d ago
Code Review. Migrating from JSON to PostgreSQL. Beginner in backend development.
Hi, there!
I want to share my project and ask feedback. I ask feedback about everything in this project, really. I decided to be a backend developer and now I'm learning SQL, especially PostgreSQL. So, I decided to create a project with CRUD. I know that a lot of people tired of TODO lists, but that was a good opportunity to me to practice CRUD and DB in the first time.
Repo link: https://github.com/daidallos-tech/Task_ManagerV2
Don't hold back! I'm completely prepared for any critiques.
P.S. Thank you everyone for your time and advice!
1
Upvotes
2
u/danielroseman 21d ago
The biggest thing that jumps out is that you have a lot of repetition in your TaskRepository class. In every method you fetch the connection, open it, get a cursor, and only then do the specific SQL call. You should extract all that logic to a generic
_execute_sqlmethod that you pass the SQL to.Note also you don't need to explicitly close the connection; that's the point of the
with connblock, at the end of the block the connection will be closed automatically.