#SQLAlchemy
FastAPI: viết CRUD chuẩn với SQLAlchemy 2.0 — session dependency và select() trong 5 phút

CRUD là bộ bốn thao tác tạo – đọc – sửa – xóa mà gần như mọi API đều cần. Cách chuẩn trong FastAPI là gom logic database vào các hàm CRUD dùng SQLAlchemy 2.0 — select(), db.get(), db.add(), db.delete() — lấy…
FastAPI: viết CRUD chuẩn với SQLAlchemy 2.0 — session dependency và select() trong 5 phút
CRUD là bộ bốn thao tác tạo – đọc – sửa – xóa mà gần như mọi API đều cần. Cách chuẩn trong FastAPI là gom logic database vào các hàm CRUD dùng SQLAlchemy 2.0 — select(), db.get(), db.add(), db.delete() — lấy session qua dependency yield tên get_db, và khai báo response_model cùng status_code rõ ràng ở từng endpoint.
linhfish.dev
November 10, 2026 at 3:21 AM
Anyway, Shimmory has a v0.2 release to now support HTTP Basic Auth properly on the OPDS paths rather than merely siphon details, and better implements routing as well.

Optimized ebooks per device model coming once I convert to SQLAlchemy.

If you use Crosspoint reader and run Grimmory (or using […]
Original post on blimps.xyz
blimps.xyz
November 10, 2026 at 4:33 PM
this bug is the absolute worst nightmare for me in a busy week, or anytime

https://github.com/sqlalchemy/sqlalchemy/discussions/13776

1. joined table inheritance for Parent AND Child
2. self-referential (of course)
3. *four levels of loading*
4. uses "selectin_polymorphic" which is a cool […]
Original post on fosstodon.org
fosstodon.org
November 10, 2026 at 2:05 PM
🚀 New Remote Job Alert!
💼 Position: Artificial Intelligence Engineer
🏢 Company: Talent Forge Group
🌍 Location: Australia
📁 Category: Software Development
💰 Salary: 180,000 - 220,000 AUD
🛠️ Skills: PYTHON, ASYNCIO, FASTAPI, PYDANTIC, SQLALCHEMY...
#RemoteJobs #RemoteWork #WorkFromHome #Hiring
November 10, 2026 at 10:11 PM
well I am back and learned a lot of tons of things backend in python fastapi with pydantic sqlalchemy and sqlmodel learned hld
November 7, 2026 at 6:40 AM
Flask: lấy bản ghi hoặc trả 404 trong 1 dòng với get_or_404() của Flask-SQLAlchemy

Khi viết API Flask, gần như endpoint nào cũng cần lấy một bản ghi theo ID: xem chi tiết user, sửa bài viết, xóa đơn hàng. Flask-SQLAlchemy 3.x có sẵn ba hàm get_or_404(), first_or_404() và one_or_404() — lấy được…
Flask: lấy bản ghi hoặc trả 404 trong 1 dòng với get_or_404() của Flask-SQLAlchemy
Khi viết API Flask, gần như endpoint nào cũng cần lấy một bản ghi theo ID: xem chi tiết user, sửa bài viết, xóa đơn hàng. Flask-SQLAlchemy 3.x có sẵn ba hàm get_or_404(), first_or_404() và one_or_404() — lấy được thì trả object, không có thì tự abort 404, khỏi viết if ... is None: abort(404) lặp đi lặp lại. Ba hàm này dùng được ngay khi bạn đã cài Flask-SQLAlchemy 3.0 trở lên.
linhfish.dev
November 6, 2026 at 11:09 PM
sqlalchemy json querybuilder lets you define database queries as json specs that translate directly to orm calls, perfect for building dynamic queries without raw sql.

https://dbtools.dev/tools/sqlalchemy-json-querybuilder

#orm #database
Sqlalchemy Json Querybuilder
Sqlalchemy Json Querybuilder converts JSON specifications into SQLAlchemy ORM queries, enabling developers to build dynamic database queries programmatically without writing raw SQL. This tool simplifies query construction for Python applications by providing a structured JSON-to
dbtools.dev
November 4, 2026 at 12:00 PM
Flask: truy vấn kiểu SQLAlchemy 2.0 bằng db.select() thay cho Model.query

Nếu bạn đang dùng Flask-SQLAlchemy 3.x mà vẫn viết Post.query.filter(...).all(), bạn đang dùng giao diện truy vấn cũ của SQLAlchemy 1.x. Cách chuẩn hiện nay là db.select() kết hợp db.session.execute(), kèm db.session.get()…
Flask: truy vấn kiểu SQLAlchemy 2.0 bằng db.select() thay cho Model.query
Nếu bạn đang dùng Flask-SQLAlchemy 3.x mà vẫn viết Post.query.filter(...).all(), bạn đang dùng giao diện truy vấn cũ của SQLAlchemy 1.x. Cách chuẩn hiện nay là db.select() kết hợp db.session.execute(), kèm db.session.get() để lấy một bản ghi theo khóa chính. Bài này đổi một truy vấn mẫu sang kiểu mới, để code thống nhất với tài liệu SQLAlchemy 2.0 và dễ mở rộng về sau.
linhfish.dev
November 4, 2026 at 3:10 AM
@glyph I tried to make the SQLAlchemy sprints we did in 2007 or so about helping with documentation and small issues and ultimately I received hate mail for making the volunteers do such boring work that didn't help them to learn anything

there were no more sprints after that
November 5, 2026 at 9:17 PM
FastAPI: dùng `def` hay `async def` cho endpoint? Chọn sai, API chậm cả hệ thống

Khi endpoint của bạn chỉ gọi hàm đồng bộ — ví dụ requests, SQLAlchemy đồng bộ hay xử lý CPU — hãy khai báo bằng def, FastAPI sẽ chạy nó trong threadpool và không chặn các request khác. Chỉ dùng async def khi bên trong…
FastAPI: dùng `def` hay `async def` cho endpoint? Chọn sai, API chậm cả hệ thống
Khi endpoint của bạn chỉ gọi hàm đồng bộ — ví dụ requests, SQLAlchemy đồng bộ hay xử lý CPU — hãy khai báo bằng def, FastAPI sẽ chạy nó trong threadpool và không chặn các request khác. Chỉ dùng async def khi bên trong có await thật sự, như gọi httpx.AsyncClient hay database bất đồng bộ. Quy tắc này áp dụng cho mọi endpoint.
linhfish.dev
November 5, 2026 at 11:13 PM
🚀 New Remote Job Alert!
💼 Position: Senior Database Engineer
🏢 Company: Battronics
🌍 Location: EU
📁 Category: Data Engineer
🛠️ Skills: SQL, POSTGRESQL, ORM, SQLMODEL, SQLALCHEMY...
#RemoteJobs #RemoteWork #WorkFromHome #Hiring #JobOpportunity
Apply now: https://www.remoteitjobs.app/job/battron
November 4, 2026 at 2:35 PM
may The Force be with you
November 4, 2026 at 1:02 AM
do folks remember the discussions here about "attestations"? so many people told me I was misunderstanding "attestations", how they had nothing to do with your existing workflow from your workstation?

look at pypi now. Clearly they are trying to SCARE THE […]

[Original post on fosstodon.org]
November 3, 2026 at 8:59 PM
⚡ New AI Tool Release: Python FastAPI & Async Architecture Prompt Studio

Generate production-grade Python FastAPI microservice blueprints with Pydantic v2 validation, Docker, and async SQLAlchemy.

Free to use: https://ai.marknhewitt.co.uk/tools/python-fastapi-microservice-prompt-builder
November 2, 2026 at 8:28 PM
I think we also get *more* bug reports because people are actually able to isolate the problem they're having whereas previously they'd have no idea where to look. Or they didn't have time. and we'd never know, they'd just be like "oh well SQLAlchemy is buggy". now they do, because it takes 30 […]
Original post on fosstodon.org
fosstodon.org
November 2, 2026 at 8:16 PM
SQLAlchemy gets relentless bug reports now. Many are regressions from the recent 2.1, that's normal, but lots from 2.0.x too. Most of these are real issues that affect real apps; the frivolous "AI fuzzer" ones have declined a lot, as the community has pushed back on those. What is not normal […]
Original post on fosstodon.org
fosstodon.org
November 2, 2026 at 8:14 PM
🚀 New Remote Job Alert!
💼 Position: Senior Python Developer (f/m/x)
🏢 Company: Sii Poland
🌍 Location: EU
📁 Category: Software Engineer
🛠️ Skills: PYTHON, FASTAPI, POSTGRESQL, SQLALCHEMY, ALEMBIC...
#RemoteJobs #RemoteWork #WorkFromHome #Hiring #JobOpportunity
Apply now: https://www.remoteitjob
October 31, 2026 at 4:35 PM
Working with databases in Python? 🐍

SQLAlchemy simplifies database interactions with SQL and ORM tools.

Check out my complete guide!

victorhugosolis.com/posts/sqlalc...

#Python #SQLAlchemy #SQL #database
October 28, 2026 at 2:12 PM
Bài này vẫn còn nguyên giá trị cho ai làm FastAPI với SQLAlchemy: quản lý DB session an toàn bằng dependency yield, tránh rò rỉ connection — đọc 5 phút là áp dụng được ngay. FastAPI: quản lý DB session an toàn bằng dependency yield trong 5 phút
FastAPI: quản lý DB session an toàn bằng dependency yield trong 5 phút
Mỗi request tới API nên có một DB session riêng, và session đó phải được đóng ngay sau khi request xong — dù thành công hay thất bại. Cách chuẩn trong FastAPI là viết một dependency dùng yield: đoạn code trước yield tạo session và giao cho endpoint, đoạn code sau yield (đặt trong finally) luôn đóng session. Áp dụng mẫu này cho mọi endpoint dùng SQLAlchemy hoặc SQLModel là xong.
linhfish.dev
October 31, 2026 at 1:12 PM
Стек технологий / Tech stack:

- Languages: Python;
- Frameworks: aiogram, fastapi, sqlalchemy;
- Locallization: Project Fluent by Mozilla;
- Deployment: Docker Swarm, multiple networks, non-root containers, multi-arch images (x86_64 / arm64), replicated;

For now it's hosted on my home server.
October 27, 2026 at 3:34 PM
Flask: Unstick Your Session After a Failed Save with db.session.rollback() in 5 Minutes

When Flask-SQLAlchemy hits a save error — a duplicate unique email, for example — the session does not recover on its own: every later operation in the same session throws PendingRollbackError until you call…
Flask: Unstick Your Session After a Failed Save with db.session.rollback() in 5 Minutes
When Flask-SQLAlchemy hits a save error — a duplicate unique email, for example — the session does not recover on its own: every later operation in the same session throws PendingRollbackError until you call rollback. The fix is to wrap commit in try/except IntegrityError and call db.session.rollback() right inside the except block. This applies to every write path: user registration, order creation, bulk import, or a seed script.
linhfish.dev
October 28, 2026 at 3:02 PM
python-sqlakeyset
Offset-free paging for SQLAlchemy
aur.archlinux.org
October 26, 2026 at 5:37 PM
Here's to the open source holding up Prefect, Dagster and FastMCP. pytest runs our tests. SQLAlchemy handles our databases. PyO3 connects Python to Rust. structlog keeps Dagster's logs in order.

To the people behind them and many more: thank you.

www.prefect.io/blog/prefect...
Prefect's open source sponsorship: 2026 update
Prefect gave $40,000 to 12 open source maintainers, project teams, and collectives in 2026, supporting the libraries behind Prefect, Dagster, and FastMCP.
www.prefect.io
October 27, 2026 at 8:32 PM
Flask: tránh session “kẹt” sau lỗi lưu dữ liệu bằng db.session.rollback() trong 5 phút

Khi Flask-SQLAlchemy gặp lỗi lưu dữ liệu, ví dụ trùng email duy nhất, session không tự hồi phục: mọi thao tác sau đó trong cùng session đều ném lỗi PendingRollbackError cho tới khi bạn gọi rollback. Giải pháp là…
Flask: tránh session “kẹt” sau lỗi lưu dữ liệu bằng db.session.rollback() trong 5 phút
Khi Flask-SQLAlchemy gặp lỗi lưu dữ liệu, ví dụ trùng email duy nhất, session không tự hồi phục: mọi thao tác sau đó trong cùng session đều ném lỗi PendingRollbackError cho tới khi bạn gọi rollback. Giải pháp là bọc commit trong try/except IntegrityError và gọi db.session.rollback() ngay trong khối except. Cách này áp dụng cho mọi chỗ ghi dữ liệu: đăng ký tài khoản, tạo đơn hàng, import hàng loạt hay script seed.
linhfish.dev
October 28, 2026 at 9:19 AM