zdennis/activerecord-import
55.7
Adequate · 14 November 2026
2.6k
lines of production code
Ruby
primary language
5
measurements over time
What this system is
This system is a Ruby gem that provides bulk import and upsert capabilities for ActiveRecord models across multiple database adapters. It enables efficient data insertion by supporting various storage engines and handling large payloads through transaction splitting and byte-size limits. The library ensures compatibility with a wide range of ActiveRecord versions and includes a benchmarking suite to measure performance against different database backends.
Features
Add MySQL benchmark schema with MyISAM, InnoDB, and Memory engines
A new schema file for MySQL benchmarks has been added, defining three test tables (test\_myisam, test\_innodb, test\_memory) that explicitly specify their storage engines (MyISAM, InnoDB, and Memory respectively) to support benchmarking across different MySQL storage backends.
benchmarks/schema · high confidence
Expanded database adapter support for ActiveRecord import
The library now supports a wider range of database connection adapters, including new additions for Trilogy and Trilogy Proxy, as well as JDBC variants for MySQL, PostgreSQL, and SQLite3. Existing adapters for MySQL2, PostgreSQL, SQLite3, and Seamless Database Pool are also explicitly wired up in this location to ensure the import functionality is correctly included in their respective ActiveRecord connection adapter classes.
_lib/activerecord-import/active\record · high confidence
Restored and documented benchmark execution capabilities
The benchmarking suite has been re-enabled, allowing users to run performance tests via the \benchmark.rb\ script. The tool now supports specifying database adapters (currently limited to MySQL), defining the number of objects to benchmark, and exporting results to CSV or HTML formats. A new README file documents these usage options and limitations.
benchmarks · high confidence
Removals
Removal of ActiveRecord import functionality
The \lib/ar-extensions/import.rb\ file has been deleted, removing the \import\ method and associated support modules (such as \supports\_import?\ and \on\_duplicate\_key\_update\) from ActiveRecord models. Users can no longer perform bulk imports of model collections or value arrays directly via this extension.
lib/ar-extensions · high confidence
Architecture
Add RuboCop configuration and project scaffolding files
The project now includes a RuboCop configuration (.rubocop.yml) targeting Ruby 3.0.x with most metrics and style checks disabled, alongside a generated .rubocop\_todo.yml to track existing offenses. Standard project scaffolding files have been added, including a .gitignore for common development artifacts, a Brewfile for local database dependencies (MySQL, PostgreSQL, SQLite), a Dockerfile for containerized development, and a docker-compose.yml for running test environments with MySQL 8.0 and PostGIS. A Rakefile has been introduced to manage tests across multiple database adapters and run RuboCop checks.
(repo-wide) · high confidence
Behavioural changes
Refactored adapter architecture with new proxy support and upsert capabilities
The adapter layer has been restructured to separate core import logic from database-specific implementations, introducing an AbstractAdapter base and dedicated adapters for MySQL, PostgreSQL, and SQLite3. This change adds support for upsert operations (ON DUPLICATE KEY UPDATE/IGNORE) across all supported databases, allowing users to handle duplicate key conflicts during bulk imports. Additionally, new proxy adapters (e.g., Mysql2ProxyAdapter, PostgreSQLProxyAdapter) are introduced to support ActiveRecord's multi-database role routing, ensuring imports respect the writing role. The MySQL adapter now correctly handles large payloads by splitting them into multiple transactions if they exceed the server's max\_allowed\_packet, and PostgreSQL imports now support returning inserted IDs and custom columns via the RETURNING clause.
lib/activerecord-import/adapters · high confidence
Renamed library from ActiveRecord::Extensions to ActiveRecord::Import
The library has been renamed from ActiveRecord::Extensions to ActiveRecord::Import. The main entry point has moved from lib/ar-extensions.rb to lib/activerecord-import.rb, which now uses ActiveSupport lazy load hooks to require the base implementation only after ActiveRecord is loaded, replacing the previous direct requires and module definition.
lib · high confidence
Restored benchmarking suite with CLI and output options
The benchmarking library has been re-enabled and refactored to support command-line execution. Users can now run benchmarks via a new CLI parser that accepts options for the database adapter (defaulting to mysql2), the number of objects to test, and specific table types. The suite includes a base benchmark runner that executes create and import operations with and without validations, and it supports exporting results to CSV or HTML reports. The HTML output includes speedup comparisons against the default create method, and the runner automatically clears tables before each benchmark run.
benchmarks/lib · high confidence
activerecord-import version 2.3.0 release
This release updates the gem to version 2.3.0. The diff shows the introduction of a new \ValueSetsBytesParser\ class in \value\_sets\_parser.rb\ which handles splitting value sets based on byte size limits, raising a \ValueSetTooLargeError\ if the limit is exceeded. The \base.rb\ file now includes logic to load adapters from a connection pool, supporting both older ActiveRecord versions (using \spec.config\[:adapter\]\) and newer ones (using \db\_config.adapter\). The \import.rb\ file contains the core import logic, including a \Validator\ class that handles validation callbacks with compatibility for various ActiveRecord versions, and supports importing through associations via \bulk\_import\. The \synchronize.rb\ file provides a method to refresh model instances from the database in bulk. These changes collectively enhance the library's ability to handle large imports safely and maintain compatibility across different ActiveRecord versions.
lib/activerecord-import · high confidence
Test coverage
Add test infrastructure for Janus, Trilogy, and JDBC database adapters; Added benchmark model definitions for InnoDB, Memory, and MyISAM storage engines.
Dependencies
Expanded Rails version support in CI gemfiles
The gemfiles directory now includes dedicated dependency configurations for ActiveRecord versions 6.1, 7.0, 7.1, 7.2, 8.0, and 8.1, as well as the development 'main' branch (8.2). This allows the project to test compatibility against a wider range of Rails releases, including the 8.1 beta and the latest development version, ensuring that updates to ActiveRecord are caught early across supported versions.
gemfiles · high confidence
Update ActiveRecord dependency to \>= 4.2 and modernize Gemfile
The gemspec now requires ActiveRecord \>= 4.2, dropping support for older versions. The Gemfile has been significantly restructured to support testing against multiple ActiveRecord versions (via AR\_VERSION) and Ruby versions, including specific adapter version pinning for mysql2, sqlite3, and pg, conditional inclusion of trilogy/activerecord-trilogy-adapter for AR 6.0+, and updated development dependencies like rubocop and factory\_bot.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 56 → 56 (-0.5)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 72 → 69 (-3.1)
- Architecture 88 → 88 (+0.0)
- Maturity 52 → 52 (+0.0)
- Readiness 43 → 43 (+0.0)
- Security 96 → 94 (-2.1)
- Domain Modelling 100 → 100 (+0.0)
- Performance 80 → 80 (+0.0)
Resolved (2)
- Hotspot: lib/activerecord-import/adapters/mysql_adapter.rb (lib/activerecord-import/adapters/mysql_adapter.rb)
- Off-boarding risk: anonymized user #1
New (2)
- Edited copy of a member (33 corresponding lines) (lib/activerecord-import/adapters/postgresql_adapter.rb)
- Off-boarding risk: anonymized user #1
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
zdennis/activerecord-import was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit ed0cdadf80c84d73314a4788cc4db3bd14e27127 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-e1a3b69fc8ee.