Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Course
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM Tools
Machine Learning
Machine Learning & AI
Machine Learning Tools
Manage Data
MLOps
Natural Language Processing
Newsletter Archive
NumPy
Pandas
Polars
PySpark
Python Helpers
Python Tips
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

Newsletter #292: SQLFluff: Auto-Fix Messy SQL with One Command

Newsletter #292: SQLFluff: Auto-Fix Messy SQL with One Command

Grab your coffee. Here are this week’s highlights.


📅 Today’s Picks

Evaluate LLM Apps in One Line with PydanticAI

Code example: Evaluate LLM Apps in One Line with PydanticAI

Problem

Testing LLM apps means validating multiple factors at once: is the answer correct, properly structured, fast enough, and natural sounding?

Rewriting this logic for every project is inefficient and error-prone.

Solution

pydantic-ai includes pydantic-evals, which provides these capabilities out of the box. Simply choose the evaluators you need and add them to your evaluation suite.

Built-in evaluators:

  • Deterministic: validate that outputs are correct, properly typed, and fast enough
  • LLM-as-judge: have another LLM grade qualities like helpfulness or tone
  • Report-level: generate classification metrics across all cases automatically

SQLFluff: Auto-Fix Messy SQL with One Command

Code example: SQLFluff: Auto-Fix Messy SQL with One Command

Problem

Consistent SQL style matters. It improves readability, speeds up code reviews, and makes bugs easier to identify.

Manual reviews can catch formatting issues, but they’re time-consuming and often inconsistent.

Solution

SQLFluff solves this with automated linting and formatting across 30+ SQL dialects. It identifies violations, applies consistent standards, and auto-corrects many problems.

SQLFluff also supports the following templates:

  • Jinja
  • SQL placeholders (e.g. SQLAlchemy parameters)
  • Python format strings
  • dbt (requires plugin)

🎓 Latest Interactive Course

Python Data Modeling with Dataclasses and Pydantic

Choosing between dict, NamedTuple, dataclass, and Pydantic comes down to how much safety you need. In this free interactive course, you’ll learn when to use each:

  • Dictionary: Flexible, but no built-in field checks. Typos and missing keys only show up at runtime.
  • NamedTuple: Immutable with fixed fields, helping catch mistakes early.
  • dataclass: Mutable data containers with defaults and optional validation logic.
  • Pydantic: Strong type validation, automatic coercion, and detailed error reporting.

All exercises run directly in your browser. No installation required.


☕️ Weekly Finds

spec-kit [Dev Tools] – Toolkit for Spec-Driven Development that helps define specs, generate plans and tasks, and implement code with AI coding tools

ty [Code Quality] – Extremely fast Python type checker and language server written in Rust, by the creators of uv and Ruff

nbQA [Code Quality] – Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks

Looking for a specific tool? Explore 70+ Python tools →

Stay Current with CodeCut

Actionable Python tips, curated for busy data pros. Skim in under 2 minutes, three times a week.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran