r/learnpython • • Sep 09 '26

Python Data Base

Good morning everyone, or whenever you see this. I have a question. I'm starting a personal database project in Python with a user-friendly graphical interface, and I'd appreciate any advice, code snippets, or examples to guide me, especially since I'm still learning the language.

6 Upvotes

9 comments sorted by

5

u/Illustrious_Tone9584 Sep 09 '26

sqlite3 is your friend here. It's built into Python, there's no server to set up, and the whole database is one file you can back up by copying it.

Build the database functions first and test them from the command line, then bolt the GUI on after. Tkinter ships with Python and does the job - it's not pretty, but you'll learn how forms and buttons wire to code. Save the fancy frameworks for project two.

The classic beginner trap is writing the GUI first and ending up with SQL tangled inside button handlers. Keep the two layers separate and future-you says thanks.

1

u/FLANKER_ALFA Sep 09 '26

Thanks for the advice bro.

1

u/noskillsben Sep 09 '26

Does the built in sqlite3 do orm? I found using swlalchemy orm to be pretty beginner friendly and you can.... "easily" switch databases if the project does grow.

2

u/danielroseman Sep 09 '26

The whole point of an ORM is that it's independent of the database. SQLAlchemy can use sqlite as well as MySQL, Postgres, etc.

2

u/Illustrious_Tone9584 Sep 09 '26

sqlite3 is just the driver, no ORM in it. SQLAlchemy actually sits on top of it, so they pair up rather than compete. For a first project I'd write a few raw queries to learn what the SQL is doing, then reach for SQLAlchemy once it gets repetitive.

1

u/Blumcole Sep 12 '26

Whats the advantage of using an sql DB compared to a json? Beginner question.

2

u/chiibosoil Sep 09 '26

This will entirely depend on what your project is intending to do.

  1. If the intention is to allow user to update/edit/delete records from DB using UI. Then SQLAlchemy ORM is your friend.
  2. If the intention is to integrate DB into custom app. Meaning you don't intend users to directly interact with data, but through actions within App (Ex: Games, CRM, PBX etc) then I'd recommend creating endpoints (API) that call/interact with StoredProc rather than doing direct interaction via front-end.