frappe-syntax-query-builder

Construct cross-database queries with frappe.qb for MariaDB and PostgreSQL.

163|53|Updated Jan 14, 2026
One-click install
npx skills add https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package --skill frappe-syntax-query-builder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frappe-syntax-query-builder
Source: https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package/tree/main/skills/source/syntax/frappe-syntax-query-builder
Command: npx skills add https://github.com/OpenAEC-Foundation/Frappe_Claude_Skill_Package --skill frappe-syntax-query-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developers often struggle to write portable, safe database queries across MariaDB and PostgreSQL when using Frappe's query builder, risking syntax drift and injection-prone code.

Core Features & Use Cases

  • Cross-db query construction with frappe.qb supporting SELECT, INSERT, UPDATE, DELETE, JOINs, aggregation, and subqueries.
  • Safe, parameterized patterns and migrations from raw SQL to the query builder for production-grade code.
  • Real-world scenarios including data extraction, reporting, and data integrity checks across multiple DocTypes.

Quick Start

Use the frappe-syntax-query-builder to generate a simple PyPika-based query example for a Sales Order DocType.

Frequently Asked Questions about frappe-syntax-query-builder

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write cross-database queries in Frappe that work on both MariaDB and PostgreSQL?

Cross-database queries in Frappe are built using frappe.qb, a PyPika-based query builder that constructs safe, parameterized SQL statements. It applies ImportMapper to translate database-specific functions, ensuring your SELECT, JOIN, and aggregation queries execute correctly across MariaDB and PostgreSQL.

What is the best way to replace raw SQL with the Frappe query builder?

The best way to replace raw SQL is migrating to frappe.qb, which enforces DocType-based table references and promotes safe run semantics. This approach prevents SQL injection risks and eliminates syntax drift, allowing you to build production-grade queries for data extraction and reporting.

Can I perform JOINs and subqueries across multiple DocTypes using frappe.qb?

Yes, frappe.qb fully supports JOINs and subqueries across multiple DocTypes. You can construct complex data extraction and reporting queries by leveraging DocType-based table references to safely interact with data across both MariaDB and PostgreSQL backends.

Does frappe.qb support INSERT, UPDATE, and DELETE operations for Frappe v14 to v16?

Yes, frappe.qb supports INSERT, UPDATE, and DELETE operations for Frappe v14 through v16 development. It constructs parameterized queries to safely modify database records, ensuring data integrity checks and cross-database compatibility across MariaDB and PostgreSQL.

Why should I use frappe.qb instead of raw SQL for data extraction in Frappe?

You should use frappe.qb instead of raw SQL to avoid brittle, injection-prone code. The query builder enforces DocType-based table references and utilizes parameterized patterns, ensuring portable, safe data extraction across MariaDB and PostgreSQL without risking syntax drift.

Are there limitations when using database-specific functions with the Frappe query builder?

The main limitation involves database-specific functions, which frappe.qb handles by utilizing ImportMapper for DB-specific translations. You must adhere to safe run semantics and parameterization to prevent cross-database syntax errors when executing complex queries across MariaDB and PostgreSQL.