SShortSingh.
Back to feed

Why storing company data as static columns erases historical truth

0
·1 views

A software developer argues that storing company attributes like CEO names and headquarters as simple database columns is fundamentally flawed, because these facts change over time and static fields cannot capture that history. When a value is overwritten, the previous data is permanently lost, making it impossible to answer questions tied to a specific point in time. The proposed fix is an event-based schema where each change is recorded as a new row with a valid_from date, a valid_to date, and a source URL, preserving the full timeline. The author also highlights the need to store date precision alongside dates, since sources often only specify a year or quarter rather than an exact day. The core principle offered is that any company fact capable of changing should be modelled as a dated, sourced event rather than a column.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to Build a Solvability Gate for the Classic 15-Puzzle Game

Developers implementing the 15-puzzle sliding game face a core challenge: determining whether a randomly generated board configuration is actually solvable before the player begins. The solvability check relies on parity math — specifically, counting inversions in the tile arrangement and tracking which row the blank tile occupies from the bottom. A board is solvable only if the blank sits on an even row with an odd inversion count, or on an odd row with an even inversion count. Common implementation errors include counting inversions with the blank tile included or measuring the blank's row from the top, which causes the gate to wrongly accept or reject boards. Beyond random shuffles, production systems must also guard against corrupt save states, illegal drag-and-drop moves, and flawed hint engines that can push the board into an unsolvable component.

0
ProgrammingDEV Community ·

Adaptive Query Routing Addresses Key Failure Points in Production RAG Systems

Basic Retrieval-Augmented Generation (RAG) pipelines fail in production when they apply vector search indiscriminately to all user queries, including simple greetings, vague questions, and out-of-domain requests. A developer has outlined an Adaptive RAG approach that classifies each query and routes it to one of three handlers: a vector store, a web search fallback, or a direct LLM response. The system uses LangChain, Pydantic, and FastAPI, with a structured router built on Google's Gemini model to make routing decisions. A relevance-grading step filters retrieved documents before they reach the LLM, reducing hallucinations caused by poor context. The approach also cuts latency for simple queries to under 300 milliseconds by bypassing embedding generation and vector lookups entirely.

0
ProgrammingDEV Community ·

How Indirect Prompt Injection Attacks Hijack AI Agents via Web Content

Indirect Prompt Injection (IPI) is an emerging cybersecurity threat targeting autonomous AI agents powered by Large Language Models and tools like the Model Context Protocol (MCP). Unlike direct prompt injection, IPI occurs when an agent ingests malicious instructions hidden within external data sources such as scraped webpages, API responses, or document feeds. Because LLMs share the same context space for both instructions and data, there is no built-in separation to distinguish trusted commands from hostile content embedded in the environment. This mirrors the classic Cross-Site Scripting (XSS) vulnerability in web development, where a browser cannot distinguish a trusted script from a malicious one injected via user content. Defending against IPI requires a layered, defense-in-depth approach that addresses how agentic systems consume, trust, and act upon unvetted external data.

0
ProgrammingDEV Community ·

How to Choose Defensible Data Thresholds Using Distribution Analysis

Data analysts routinely face the challenge of setting cutoffs — such as minimum reviews or purchases — that define key categories in their work, and the quality of those decisions determines the credibility of downstream results. A structured four-step method recommends first measuring how values distribute across a dataset, then pricing each candidate threshold by counting how many records survive it. The approach was demonstrated using 68 years of Billboard chart data, where 57% of charting artists appeared only once, leading analysts to define a 'known artist' as one with five or more charted songs. That specific cutoff was chosen because it reflected repeated industry recognition across a career while preserving a large enough population for meaningful analysis. Crucially, all rejected thresholds and their trade-offs were documented alongside the final query, allowing any reviewer to scrutinize or challenge the decision with full context.