:::warning AUTO-GENERATED — do not edit
This page is generated from the MCP server snapshot content/backend-mcp.json.
Edit the source MCP server (not this file), then run npm run generate.
:::
Read data via dynamix_wrapper.get_sqlalchemy_connection_string() + SQLAlchemy SELECT
When to use: A route must read data from the database.
Prerequisites
- The route handler exists and is auth-guarded.
- You know the target table/columns and the filter (typically by fk_user or a domain key).
Steps
Step 1: Fetch the canonical database access pattern.
Tools: get_db_pattern
Step 2: Obtain the connection string via dynamix_wrapper.get_sqlalchemy_connection_string().
Step 3: Create a SQLAlchemy engine from that string and execute a parameterized SELECT.
Step 4: Map rows to the response envelope and return them.
Step 5: Run the verify gate.
Tools: validate_backend_endpoint
Full recipe definition
The complete machine-readable recipe as returned by the MCP server:
{
"id": "wire-db-read",
"title": "Read data via dynamix_wrapper.get_sqlalchemy_connection_string() + SQLAlchemy SELECT",
"when": "A route must read data from the database.",
"prerequisites": [
"The route handler exists and is auth-guarded.",
"You know the target table/columns and the filter (typically by fk_user or a domain key)."
],
"steps": [
{
"action": "Fetch the canonical database access pattern.",
"tools": [
"get_db_pattern"
],
"note": "Returns how to obtain the connection string and run a parameterized SELECT. Do not invent an ORM session or raw driver."
},
{
"action": "Obtain the connection string via dynamix_wrapper.get_sqlalchemy_connection_string().",
"files": [
"src/routes/<domain>_routes.py"
],
"note": "Never build the connection string by hand or read DB creds from the request/env directly — always call the wrapper."
},
{
"action": "Create a SQLAlchemy engine from that string and execute a parameterized SELECT.",
"files": [
"src/routes/<domain>_routes.py"
],
"note": "Use bound parameters (text(...).bindparams / :param) — never f-string SQL. Dispose/close the connection when done."
},
{
"action": "Map rows to the response envelope and return them.",
"files": [
"src/routes/<domain>_routes.py"
],
"note": "Return only the columns the route contract promises — do not leak extra table columns."
},
{
"action": "Run the verify gate.",
"tools": [
"validate_backend_endpoint"
],
"note": "Follow run-verify."
}
],
"filesToCreate": [],
"validation": [
"Connection string comes from dynamix_wrapper.get_sqlalchemy_connection_string().",
"SELECT is parameterized (no string-interpolated SQL).",
"Route returns the expected rows for a known key."
],
"doneCriteria": [
"Read path uses the wrapper connection string + a parameterized SQLAlchemy SELECT.",
"run-verify passes."
],
"commonMistakes": [
"Hand-constructing the connection string instead of calling the wrapper.",
"f-string / string-concatenated SQL (SQL injection risk) instead of bound params.",
"Leaking DB columns not in the route contract.",
"Leaving the engine/connection open (no dispose/close)."
],
"relatedRecipes": [
"create-endpoint",
"wire-db-write",
"add-pagination",
"run-verify"
]
}