HomeBlog

Posts tagged with: #Database

Reusable Model Fields in SQLModel with Mixins

September 20, 2025

Reusable Model Fields in SQLModel with Mixins

A Guide to Creating DRY Database Models with Timestamps and Base Models.

Stop repeating id and timestamp fields in your SQLModel models. Learn to use mixins and a base model to write cleaner, more maintainable code for your FastAPI application.

Read More...

Connecting FastAPI to a Database with SQLModel

August 26, 2025

Connecting FastAPI to a Database with SQLModel

A practical guide to building CRUD APIs with FastAPI and SQLModel.

Learn to connect FastAPI to SQL databases using SQLModel. This guide covers creating models, managing sessions, and building a complete CRUD API with practical examples.

Read More...

Running Database Migrations with Alembic in Google Cloud Build

June 30, 2025

Running Database Migrations with Alembic in Google Cloud Build

How to Organize and Load FastAPI Settings from a .env File Using Pydantic v2

Learn how to centralize your FastAPI configuration using Pydantic Settings and a .env file. This post covers setup, usage, and best practices for managing environment variables and secrets in a maintainable way.

Read More...

Connecting FastAPI to a Serverless Database with pool_pre_ping

June 10, 2025

Connecting FastAPI to a Serverless Database with pool_pre_ping

How to Keep FastAPI Connected to Serverless Databases Like Neon

Learn how to keep your FastAPI app connected to serverless databases like Neon, even when they scale down to zero. This post explains how to use SQLAlchemy's pool_pre_ping=True to automatically reconnect and avoid broken connections, with practical code examples and .env setup.

Read More...

Full-Text Search: Using the Trigram Tokenizer Algorithm to Match Peoples Names

April 24, 2025

Full-Text Search: Using the Trigram Tokenizer Algorithm to Match Peoples Names

Leveraging Full Text Search and Trigram Tokenization for Efficient Name Matching

This article explains how to use SQLite's FTS5 module with the trigram tokenizer to perform efficient full-text searches, particularly for matching similar names in a large database. It covers setting up the virtual table, normalizing names, bulk inserting data, and executing searches that handle close but not exact matches

Read More...

Contact Me

Have a project in mind? Send me an email at hello@davidmuraya.com and let's bring your ideas to life. I am always available for exciting discussions.

© 2025 David Muraya. All rights reserved.