coding-with-query-engine

Construct Mu2e Query Engine URLs for PostgreSQL data access.

4|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/Mu2e/aitools --skill coding-with-query-engine
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coding-with-query-engine
Source: https://github.com/Mu2e/aitools/tree/main/skills/coding-with-query-engine
Command: npx skills add https://github.com/Mu2e/aitools --skill coding-with-query-engine

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill simplifies the process of building and troubleshooting Mu2e Query Engine (QE) URLs for accessing PostgreSQL-backed data, enabling efficient data retrieval in Python and C++.

Core Features & Use Cases

  • QE URL Construction: Guides users in composing valid Query Engine URLs with various parameters like database, table, columns, filters, and sorting.
  • Python HTTP Reads: Provides patterns for fetching data from QE endpoints using Python's urllib.
  • C++ Database Fetches: Demonstrates how to use Mu2e's DbService wrappers (DbReader, DbIdList) for C++ applications.
  • Use Case: Retrieve specific run information from the run_info database by constructing a QE URL with appropriate filters and then fetching the data using a Python script.

Quick Start

Use the coding-with-query-engine skill to build a QE URL to fetch the 'name' and 'version' columns from the 'app.versions' table in the 'mu2e_conditions_prd' database.

Frequently Asked Questions about coding-with-query-engine

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

FAQPage Schema
How do I build a valid Query Engine URL for accessing Mu2e PostgreSQL data?

Query Engine URL construction involves specifying parameters like database, table, columns, filters, and sorting to access Mu2e PostgreSQL data. This format enables efficient data retrieval from Mu2e conditions and operations databases.

How do I fetch Mu2e database records using Python?

Fetching Mu2e database records in Python uses the urllib library to perform HTTP reads of constructed Query Engine URLs. This method retrieves specific run information and conditions data directly from PostgreSQL endpoints.

Can I use C++ to read Mu2e PostgreSQL data instead of Python HTTP requests?

Yes, C++ can read Mu2e PostgreSQL data using Mu2e DbService wrappers like DbReader and DbIdList. These wrappers facilitate direct database fetches for C++ applications without needing HTTP URL construction.

What is the difference between Python HTTP reads and C++ DbService for Mu2e data retrieval?

Python HTTP reads use urllib to fetch data via Query Engine URLs, while C++ DbService uses DbReader wrappers for direct database access. The choice depends on your application's language and whether URL-based or direct database access is preferred.

How do I filter specific run information from the Mu2e run_info database?

Filtering specific run information from the run_info database requires constructing a Query Engine URL with appropriate filter parameters. This URL is then executed via a Python script to retrieve the targeted data.

Does the Mu2e Query Engine support retrieving specific columns from the app.versions table?

Yes, the Mu2e Query Engine supports retrieving specific columns by constructing a URL that targets the app.versions table in the mu2e_conditions_prd database. You can specify desired columns like name and version directly in the URL parameters.