𝗗𝗲𝗮𝗿 𝗕𝗮𝗰𝗸𝗲𝗻𝗱 𝗗𝗲𝘃𝘀, When building an application with FastAPI and PostgreSQL, how do you handle database changes that build on a previous migration? Do you prefer rolling back (downgrading) the existing migration before making changes, or do you apply a new migration on top of the existing one? Although, I prefer the latter, what do you think? 😊 #Python #FastAPI #BackendDevelopment #BackendEngineering
Handling Database Changes in FastAPI with PostgreSQL
More Relevant Posts
-
𝗕𝗮𝗰𝗸𝗲𝗻𝗱 𝗧𝗶𝗽 📌 Try not to use '#' when creating a password on Pgadmin for PostgreSQL. (Especially if you are used to using # for your passwords) Cause when connecting your database to your codebase python recognises the '#' sign as a comment signifier. Although you can still pybass this issue if you already done this by URL encoding and passing it as a variable in your .env file. But believe me it's not worth the stress. ✨😊. #BackendDevelopment #Python #BackendEngineering
To view or add a comment, sign in
-
One Python backend mistake that quietly hurts performance ❌ Running database queries inside loops for user in users: profile = Profile.objects.get(user=user) Looks harmless… until your user base grows 😬 Congrats, you've just invited the N+1 query problem. ✅ Better approach profiles = Profile.objects.filter(user__in=users) 📈 Why this small change matters: Prevents N+1 queries Drastically cuts down database hits Improves API response time Scales much better in production 💡 Backend performance isn't about writing more code. It's about writing smarter queries. 💬 Have you run into N+1 issues in real-world projects? How did you catch or fix them? #python #django #backenddevelopment #performanceoptimization #database #softwareengineering #webdevelopment https://lnkd.in/dxwAC3FF
To view or add a comment, sign in
-
Most tutorials get this wrong. When dealing with large datasets or infinite sequences in Python, you might reach for familiar loops. But if you're building this like you would in Java or C++, you're missing out on a core Pythonic strength: generators for memory efficiency. The Pythonic way to think about generators is that they're not storing a whole collection in memory. Instead, they yield one item at a time, on demand. This means you can work with data structures that are much larger than your available RAM, or even sequences that never end. It's about producing values lazily, only when you ask for them. Consider processing a massive log file: Okay (Inefficient): def readlargefile_bad(filepath): with open(filepath, 'r') as f: return f.readlines() # Loads entire file into memory! # This will crash if the file is too big # data = readlargefilebad('verylarge_log.txt') # for line in data: # process(line) Best (Memory Efficient): def readlargefile_good(filepath): with open(filepath, 'r') as f: for line in f: # Iterates line by line, no full load yield line # Works even for enormous files for line in readlargefilegood('verylarge_log.txt'): process(line) Takeaway: Generators are your go-to for memory-efficient iteration over large or infinite sequences in Python. #Python #CodingTips
To view or add a comment, sign in
-
-
If you’re using #MicrosoftFabric SQL Database, the #Python notebook is seriously your friend. Row based ingestion straight into SQL Server, and the throughput is… not bad at all. Powered by #DuckDB writing directly to #SQLServer via this excellent extension 👇 https://lnkd.in/gtwAdhmg Simple. Practical. Effective. #duckdb #sqlserver #microsoftfabric #python #dataengineering
To view or add a comment, sign in
-
-
If you’re working with MariaDB with Python for CRUD ops, this walkthrough is a solid place to start. #MariaDB #MySQL #Python #CRUD #Database #OpenSource #LAMP #DevOps #SysAdmin #Backend #MariaDBFoundation #PostgreSQL https://lnkd.in/gVqdKdDJ
To view or add a comment, sign in
-
Those who are amazed by LLMs ability to code should ask it to generate SPARQL queries to query DBPedia. You can try the results in DBPedia SPARQL editor. Yes, there may be million times more Python codes than SPARQL queries available for LLMs to learn from, one must wonder: if these models are genuinely intelligent, shouldn't they have mastered SPARQL by now?
To view or add a comment, sign in
-
TinyDB: A Lightweight JSON Database for Small Projects From https://lnkd.in/e_7bMpvu If you're looking for a JSON document-oriented database that requires no configuration for your Python project, TinyDB could be exactly what you need.
To view or add a comment, sign in
-
One Python backend mistake that silently kills performance Doing database queries inside loops: for user in users: profile = Profile.objects.get(user=user) This looks fine… until your user count grows 😬 Optimized approach: profiles = Profile.objects.filter(user__in=users) Why this matters: Avoids N+1 query problem Reduces database hits drastically Improves API response time Scales better in production Backend performance is not about writing more code, it’s about writing efficient queries. 💬 Have you faced N+1 issues in real projects? #python #django #backenddeveloper #performanceoptimization #database #softwareengineering
To view or add a comment, sign in
-
📅 Day 12/30 – Requests Module in Python Today I learned how to use the Requests module to send HTTP requests and interact with APIs. What I covered: • Installing the requests library • Sending GET and POST requests • Handling response objects • Working with JSON data • Checking status codes • Basic API integration Understanding how Python communicates with web services is powerful 💪 📚 Learning resource: HackerBytez – https://lnkd.in/gzKTANVt Step by step, moving closer to real-world application development 🚀 #Day12 #PythonChallenge #30DaysOfPython #RequestsModule #Python #APIs #LearningInPublic #CodingJourney
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development