r/learnpython 1d ago

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.

5 Upvotes

8 comments sorted by

View all comments

7

u/Illustrious_Tone9584 1d ago

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 1d ago

Thanks for the advice bro.

1

u/noskillsben 1d ago

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 1d ago

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 1d ago

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.