Hey everyone,
Today was one of those days where I didn’t just code… I struggled, failed, learned, and improved.
I started with a clear goal:
Replace SQLite with PostgreSQL
Store all my project data in a real database
Sounds simple right?
But the journey had some twists.
My Initial Plan
My project was using SQLite. It was easy, but not scalable.
So I decided:
- Remove SQLite completely
- Integrate PostgreSQL
- Use
.envfor security - Store everything in database
Step 1: Database Setup
I installed PostgreSQL and opened pgAdmin.
Then I:
- Created a database →
social_media_db - Designed tables using DDL
- Ran SQL successfully
That moment felt good — my database was ready.
Step 2: Integration Attempt
Next, I started integrating it into my code.
I:
- Removed
sqlite3 - Added
psycopg2 - Created a
db.pyconnection file - Updated queries (
?→%s)
Problems I Faced
This is where things got real.
- Connection errors
- Query syntax mistakes
- Forgot
commit() - Small bugs everywhere
At first, I thought:
“Why is this so hard?”
But slowly I understood…
What I Learned
- SQLite and PostgreSQL are NOT the same
- Small syntax changes matter
- Database connection must be handled properly
- Errors are part of learning
Change in Thinking
At one point, I felt:
“Maybe I should try a better setup…”
That’s when I started thinking about Docker.
Because:
- It gives clean environment
- Easy to manage services
- Industry-level approach
My Realization
Today I understood something important:
Learning backend is not just coding…
It’s about understanding systems.
My Takeaway
- I successfully designed and created my PostgreSQL database
- I started integrating it into my project
- I faced real-world problems
- And I didn’t give up
Final Thought
Today was not perfect.
But it was real.
Failures taught me more than success.
And tomorrow… I come back stronger
Top comments (0)