skip to content

Querying & Raw SQL

Where a query is declared and in what form: behind a data-access interface, as an object-level string, a typed builder, or hand-written SQL. Asked because the form decides refactoring safety.

on this pageshow

questions

page 2 of 2

As a lead, how would you pick a house query-authoring style for a large, long-lived codebase?

level: principalimportance: should knowfreq 44%

basics

~20 s

Score the codebase on rename safety, control of emitted SQL, portability, readability at three joins, runtime assembly, discoverability and build cost; then set one default, one named escape hatch, and an enforcement point. Mixed styles collapse to the weakest.

open as a page

What do read paths that project lose from the mapped model's invariants, and how do you stop the two drifting?

level: principalimportance: should knowfreq 43%

basics

~20 s

They lose behaviour the mapped model carried - derived values, rounding rules, visibility and soft-delete predicates - and must re-express it in the statement. The rule then exists twice, and only a shared test keeps the copies honest.

open as a page

A team defends its data-access interfaces by saying the store can be swapped underneath. How would you evaluate that claim?

level: principalimportance: should knowfreq 44%

basics

~20 s

Interfaces preserve method names and result shapes, not semantics. Write-back of tracked objects, multi-call atomicity, conflict behaviour, ordering stability and latency do not travel. Keep the boundary for naming, fetch-plan ownership and testability, not portability.

open as a page

When is a data-access layer with no tracked set the right choice for a service, and what does it cost?

level: principalimportance: should knowfreq 41%

basics

~20 s

It fits set-shaped and read-heavy work, bulk and streaming paths, latency-sensitive endpoints and shapes close to the tables. It costs hand-assembled graphs, hand-ordered writes, hand-written concurrency checks, and discipline enforced by review rather than by the layer.

open as a page

How does a data-access layer invoke a server-side routine, and how do results come back to the caller?

level: middleimportance: nice to knowfreq 52%

basics

~20 s

A layer calls a routine through a callable form declaring each parameter's direction, not through a plain query. Results arrive as result sets, as output parameter values, or as a returned value, consumed in that order.

open as a page

One data-access interface is backed by a tracking mapper in one service and an untracked layer in another; what is not interchangeable?

level: seniorimportance: nice to knowfreq 33%

basics

~20 s

The lifecycle semantics the signature cannot express: whether mutating a result persists it, when writes land, whether associations are live, whether repeated reads share an instance, and whether conflicts are checked. Same types, different caller rules.

open as a page

showing 31–36 of 36