Skip to main content

Data Quality, Observability & Governance

Reliable data engineering is not just about moving data from one system to another. It is about ensuring that data is complete, valid, timely, understandable, and safe to use. Interviewers often use these questions to evaluate how you detect failures, contain bad data, coordinate across teams, and protect analytical consumers.

1. How would you detect a sudden drop in source data volume?

What the interviewer is testing: Your ability to detect anomalies proactively instead of relying only on pipeline failures.

Answer: I would monitor source volume at multiple levels—total records, records by business date, records by key dimensions, and file or partition counts. I would compare current volume with historical patterns and business expectations rather than using only a fixed threshold.

A practical approach

  1. Establish a baseline: Calculate expected volume by source, weekday, hour, or business cycle. Monday traffic may naturally differ from Sunday.
  2. Measure at ingestion: Capture row counts, file sizes, source timestamps, maximum event time, and partition counts.
  3. Detect anomalies: Alert on percentage drops, statistical deviations, missing partitions, or zero-record loads.
  4. Localize the issue: Compare source counts with landing-zone, staging, and curated-layer counts to identify where records disappeared.
  5. Respond safely: Quarantine or mark the affected partition as incomplete, notify the owner, and prevent downstream publication when the threshold is critical.
Example: A daily customer feed usually contains around 1 million records, but today's load contains only 420,000. A 58% drop triggers an alert. Before failing the pipeline, check whether the source extract is partial, a filter changed, or the business legitimately had lower activity.

Example SQL:

WITH daily_counts AS (
  SELECT
    source_name,
    business_date,
    COUNT(*) AS row_count
  FROM raw_orders
  GROUP BY source_name, business_date
),
with_baseline AS (
  SELECT
    source_name,
    business_date,
    row_count,
    LAG(row_count) OVER (
      PARTITION BY source_name
      ORDER BY business_date
    ) AS previous_count
  FROM daily_counts
)
SELECT
  source_name,
  business_date,
  row_count,
  previous_count,
  ROUND(
    100.0 * (previous_count - row_count)
    / NULLIF(previous_count, 0), 2
  ) AS drop_pct
FROM with_baseline
WHERE previous_count > 0
  AND row_count < previous_count * 0.70;

This is a simple example using the previous day's count. Production monitoring should compare against seasonality-aware baselines and handle expected source delays.

Interview tip: Distinguish between an alert and a quality gate. An alert informs someone; a quality gate prevents incomplete or suspicious data from being published when the risk warrants it.

2. How do you prevent bad data from reaching downstream dashboards?

Answer: I would implement quality checks as explicit pipeline gates between ingestion, transformation, and publication. The key is to identify which failures require blocking data and which can be handled through warnings or quarantine.

LayerChecksAction on failure
IngestionFile presence, schema, row count, freshnessRetry, quarantine, or mark incomplete
StagingNulls, duplicates, type validity, key integrityReject invalid records or fail the batch
Curated modelsBusiness rules, referential integrity, reconciliationBlock publication for critical failures
Dashboard servingFreshness status, completeness, release versionShow stale/incomplete status or retain last-good version

Design principles

  • Validate early: Catch malformed records and schema violations as close to ingestion as possible.
  • Separate critical and noncritical checks: A missing primary key may block publication; a small number of optional descriptive fields may only trigger a warning.
  • Quarantine bad records: Store rejected rows with the reason, source, batch ID, and ingestion timestamp for investigation and replay.
  • Publish atomically: Build and validate a new partition or table version, then switch consumers to it only after validation passes.
  • Make quality visible: Expose freshness, completeness, and last successful load status to dashboard users.
if schema_valid and freshness_ok and critical_tests_pass:
    publish_validated_dataset()
else:
    quarantine_invalid_records()
    mark_dataset_not_ready()
    notify_data_owner()

Strong interview point: Do not silently replace a trusted dataset with a partial load. Depending on the business use case, retain the last known-good version and clearly communicate that it is stale, rather than presenting bad data as current.

3. What is the difference between data quality and data observability?

Short answer: Data quality checks whether data meets defined expectations. Data observability helps you understand the health of data and pipelines over time, detect unexpected behavior, and investigate the cause.

DimensionData qualityData observability
Primary questionDoes the data meet expectations?What changed, where, and why might it have changed?
Typical signalsValidity, uniqueness, completeness, accuracyFreshness, volume, schema changes, distribution, lineage, job health
ExampleOrder ID must not be nullOrder volume dropped 45% after an upstream release
Best useEnforce known rulesDetect unknown issues and speed up diagnosis

They complement each other. A pipeline can pass all predefined quality tests and still be unhealthy—for example, it may contain valid records but be six hours late. Observability can detect the freshness problem even when row-level validation passes.

Remember: Quality is about meeting expectations; observability is about understanding data health and diagnosing deviations. Observability tools do not replace meaningful quality rules.

4. How would you enforce a data contract between two teams?

Answer: I would make the contract explicit, version-controlled, machine-readable where possible, and tested automatically in CI/CD and at runtime. A contract should describe not only field names and data types, but also semantics and operational expectations.

What a useful contract includes

  • Schema: Field names, data types, nullability, and allowed values.
  • Semantics: Definitions of fields, units, time zones, primary keys, and business meaning.
  • Quality rules: Uniqueness, referential integrity, valid ranges, and completeness requirements.
  • Delivery expectations: Refresh frequency, freshness SLA, expected volume, and availability window.
  • Change policy: Versioning, compatibility rules, deprecation periods, owners, and communication requirements.
  • Security classification: Sensitive fields, access restrictions, retention, and permitted use.

Enforcement workflow

  1. Producer and consumer teams agree on the schema and business meaning.
  2. Store the contract in version control alongside the producer's model or pipeline.
  3. Run compatibility and data-quality tests during pull requests and deployment.
  4. Validate incoming data at runtime and route violations to quarantine or a controlled failure path.
  5. Publish contract changes with an owner, version, migration plan, and deprecation window.
  6. Monitor violations and notify both teams with actionable details.
# Illustrative contract, not a vendor-specific format
dataset: orders
version: 2
fields:
  order_id:
    type: string
    nullable: false
  order_total:
    type: decimal
    nullable: false
expectations:
  unique_key: order_id
  freshness_minutes: 60
  owner: commerce-data-team

Handling a breaking change: Prefer an additive change where possible. For a breaking change, publish a new contract version, allow a transition period, migrate consumers, monitor usage of the old version, and remove it only after agreed consumers have moved.

Interview tip: A document alone does not enforce a contract. Enforcement comes from automated compatibility checks, runtime validation, ownership, versioning, and an agreed response to violations.

5. How would you trace the impact of a breaking schema change?

Answer: I would combine schema-change detection with data lineage, dependency metadata, repository search, and automated tests. The goal is to identify direct and indirect consumers before deployment, then verify the change after release.

Step-by-step impact analysis

  1. Detect the change: Compare the new schema with the registered or previously deployed schema. Identify removed or renamed fields, incompatible type changes, and altered semantics.
  2. Classify compatibility: Adding an optional field is often backward-compatible; removing a field or changing its type can break consumers. Actual compatibility depends on the format, registry rules, and consumer behavior.
  3. Trace lineage: Find downstream tables, dbt models, views, dashboards, feature pipelines, exports, and APIs that depend on the changed field.
  4. Search code and metadata: Check SQL, transformation code, orchestration definitions, and declared dependencies. Lineage alone may miss dynamic SQL or undocumented consumers.
  5. Test affected assets: Run unit tests, schema tests, integration tests, and targeted data comparisons in a non-production environment.
  6. Plan rollout: Use an expand-and-contract migration when possible: add the new field or version, migrate consumers, monitor, and only then remove the old field.
  7. Verify after deployment: Monitor failed jobs, data-quality results, freshness, and consumer errors.
Example: An upstream team changes customer_id from an integer to a string. Impact analysis should identify transformations that cast it to an integer, joins using that key, dashboards grouped by customer, and ML features that rely on its previous representation.

Useful engineering practices: Maintain searchable lineage metadata, version schemas, require compatibility checks in pull requests, assign clear dataset ownership, and make dependency graphs available to both producers and consumers.

6. How would you protect sensitive data in analytical pipelines?

Answer: I would apply security controls across the entire data lifecycle—from ingestion and storage through transformation, analytics, sharing, and deletion. The design should follow least privilege and use the minimum sensitive data necessary for each use case.

ControlHow it helpsExample
ClassificationIdentifies sensitive fields and required controlsClassify email, phone, financial, and regulated identifiers
Least privilegeLimits who and what can access dataSeparate service accounts and role-based access
EncryptionProtects data at rest and in transitManaged encryption keys and TLS
MinimizationReduces exposure by limiting copied dataDrop unused identifiers before analytical marts
Masking / tokenizationReduces direct exposure of identifiersMask emails in non-production environments
AuditingSupports investigation and complianceLog access, permission changes, and data exports
Retention & deletionAvoids keeping sensitive data longer than necessaryApply retention rules and propagate deletion requests

Additional controls for analytics platforms

  • Use row-level and column-level security where consumers require different views of the same dataset.
  • Keep secrets in a managed secret store; never hard-code credentials in SQL, notebooks, or pipeline configuration.
  • Prevent sensitive values from appearing in logs, error messages, test fixtures, or monitoring payloads.
  • Use synthetic or appropriately masked data in development and testing.
  • Scan for sensitive fields and track their lineage into derived tables, extracts, and feature stores.
  • Review cross-project sharing, external exports, and service-account permissions regularly.
Senior-level point: Security is not just encryption. A secure pipeline also needs identity and access management, data minimization, classification, auditability, retention controls, and governance over downstream copies.

Quick Revision Table

QuestionKey points to mention
Detect volume dropsHistorical baseline, anomaly thresholds, partitions, source-to-target reconciliation
Block bad dataQuality gates, quarantine, atomic publication, last-known-good data
Quality vs observabilityDefined expectations vs health signals and diagnosis
Enforce contractsSchema, semantics, tests, ownership, versioning, runtime validation
Trace schema impactCompatibility checks, lineage, code search, tests, staged migration
Protect sensitive dataLeast privilege, encryption, minimization, masking, audit, retention

Scenario-Based Follow-Up Questions

Practice explaining your reasoning out loud. Expand each question to reveal the main points a strong answer should cover.

Scenario 1: A source delivers 70% fewer records, but the pipeline succeeds. What do you do?
Check historical and seasonality-aware baselines, source extraction logs, partition completeness, and counts at each layer. Determine whether the drop is expected or caused by a filter, partial extract, or upstream issue. If it violates a critical threshold, mark the dataset incomplete, prevent publication, alert the owner, and preserve the previous good version if appropriate.
Scenario 2: A producer wants to remove a column used by multiple dashboards.
Use lineage and repository searches to identify consumers, validate the change's compatibility, notify owners, and agree on a migration timeline. Introduce a replacement or new contract version, migrate consumers, test the new path, monitor old-column usage, and remove the field only after consumers have migrated.
Scenario 3: A quality check fails for 0.2% of records. Should the pipeline fail?
It depends on the rule and business impact. A violation of a primary key or financial reconciliation rule may require blocking publication. A small number of invalid optional attributes may be quarantined while valid records continue, if the contract permits it. Define thresholds and actions before incidents occur, and report rejected counts and reasons transparently.
Scenario 4: Analysts need a sensitive field for a legitimate use case.
Verify the purpose and authorization, grant least-privilege access, and expose only the minimum necessary data. Consider a masked or tokenized value, a restricted view, row/column-level policies, and audited access. Follow applicable policy and legal requirements for retention, sharing, and deletion.

Chapter Summary

  • Monitor volume, freshness, and completeness against meaningful baselines.
  • Use quality gates to stop critical bad data before publication.
  • Combine data quality rules with observability signals for faster diagnosis.
  • Make data contracts executable through automated tests and runtime validation.
  • Use lineage, compatibility checks, and staged migrations for schema changes.
  • Protect sensitive data throughout its lifecycle with least privilege and minimization.

Practice Challenge

Design a data-quality framework for a daily sales pipeline. Define three volume or freshness checks, two record-level quality rules, the conditions that block dashboard publication, and how you would alert owners and trace the impact of a schema change.

Comments

Popular posts from this blog

Tricky Questions or Puzzles in C ( Updated for 2026)

Updated for 2026 This article was originally written when C/C++ puzzles were commonly asked in interviews. While such language-specific puzzles are less frequent today, the problem-solving and logical reasoning skills tested here remain highly relevant for modern Software Engineering, Data Engineering, SQL, and system design interviews . Why These Puzzles Still Matter in 2026 Although most Software &   Data Engineering interviews today focus on Programming, SQL, data pipelines, cloud platforms, and system design , interviewers still care deeply about how you think . These puzzles test: Logical reasoning Edge-case handling Understanding of execution flow Ability to reason under pressure The language may change , but the thinking patterns do not . How These Skills Apply to Data Engineering Interviews The same skills tested by C/C++ puzzles appear in modern interviews as: SQL edge cases and NULL handling Data pipeline failure scenarios Incremental vs ...

Programs and Puzzles in technical interviews i faced

I have attended interview of nearly 10 companies in my campus placements and sharing their experiences with you,though i did not got selected in any of the companies but i had great experience facing their interviews and it might help you as well in preparation of interviews.Here are some of the puzzles and programs asked to me in interview in some of the good companies. 1) SAP Labs I attended sap lab online test in my college through campus placements.It had 3 sections,the first one is usual aptitude questions which i would say were little tricky to solve.The second section was Programming test in which you were provided snippet of code and you have to complete the code (See Tricky Code Snippets  ).The code are from different data structures like Binary Tree, AVL Tree etc.Then the third section had questions from Database,OS and Networks.After 2-3 hours we got the result and i was shortlisted for the nest round of interviews scheduled next day.Then the next day we had PPT of t...

Decorators in Python

Decorators provide additional functionality to the functions without directly changing their definition of them. Basically, it takes the functions as an argument, adds functionality to them, and returns it.  Before diving deep into the concept of Decorators, let's first try to understand  What are functions in Python and what is an inner function? In Python everything is Objects, be it Class, Variables, and Functions . So functions are python first-class objects that can be used or passed as an argument. You can store the functions in variables, you can pass a function to another function as parameters, and you can also return the function from the function. Below is one simple example where we are treating functions as objects . def make_me_lowercase ( str ): return str .lower() print (make_me_lowercase( "HELLO World" )) copy_of_you = make_me_lowercase print (copy_of_you( "HELLO World" )) The output of the above calls for both the functio...