Skip to main content
All CollectionsLineage
Extracting Lineage from Ruby Active Record
Extracting Lineage from Ruby Active Record
Updated over a week ago

What is Active Record?

Active Record is an Object-Relational Mapping (ORM) framework built into Ruby on Rails, designed to simplify the interaction between Ruby applications and databases. It allows developers to map Ruby classes to database tables, making it easy to perform CRUD (Create, Read, Update, Delete) operations using Ruby methods rather than raw SQL. Active Record automates database interactions, meaning developers can focus on application logic while Active Record handles the underlying database management. This abstraction promotes cleaner, more maintainable code while seamlessly integrating with the Rails ecosystem, making database management more intuitive for developers.

Why Is Active Record Lineage and Schema Management Crucial?

Active Record often serves as the primary layer for interacting with operational databases in Ruby on Rails applications, particularly in OLTP environments (e.g. Postgres). These databases are commonly ingested into data warehouses like Snowflake or BigQuery using ETL tools such as Stitch or AirByte. Once in the data warehouse, data is transformed using tools like dbt or Matillion, and the results are consumed by BI tools such as Looker or Tableau.

As a result, any change made to the upstream Active Record models can impact the entire data stack, affecting downstream transfomrations, dashboards, machine learning models, and more. It’s vital for teams relying on this data to be alerted when upstream changes—like column renaming or deletion—occur, so they can adjust their systems proactively and avoid data quality issues.

Automated Active Record Schema Extraction from Code

The Foundational Code Engine automates schema and lineage extraction by analyzing Active Record models directly from your code. This allows for early detection of schema changes during development or pending Pull Requests (PRs), helping teams evaluate potential downstream impacts before deploying updates.

A Unique Approach Compared to Traditional Methods

Example of Ruby Active Record model


While many tools retrieve schema information directly from databases post-deployment, Foundational’s approach involves extracting schema definitions directly from the Active Record definitions within the code. This allows customers to gain visibility into schema changes earlier in the development cycle, reducing the risk of breaking changes in production systems.

Setup Instructions

Setting up Active Record schema and lineage extraction with Foundational is simple. Just connect your repository containing the Active Record models, and the Code Engine will automatically detect and extract the schema details.

Once connected, the Code Engine scans and processes the Active Record models, providing visibility into the schema and lineage within your application, all without requiring database acces

Did this answer your question?