A Ruby gem that traverses ActiveRecord associations to generate SQL snapshots of real-world data for development environments.
Polo is a Ruby gem that creates sample database snapshots from production data for use in development environments. It starts from an ActiveRecord seed object, traverses its associations, and generates SQL INSERT statements that can be imported elsewhere. This allows developers to work with realistic, relational data without risking production side effects.
Ruby on Rails developers who need realistic, relational data in development or testing environments, particularly those working with complex ActiveRecord models and associations.
Developers choose Polo because it automates the tedious process of extracting relational data snapshots, provides configurable handling for duplicates and sensitive data, and integrates seamlessly with ActiveRecord. Unlike manual fixtures or static dumps, it captures real-world data relationships dynamically.
Polo travels through your database and creates sample snapshots so you can work with real world data in development.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Polo automatically follows whitelisted ActiveRecord associations to capture related data, demonstrated in examples like traversing from chefs to recipes to ingredients.
Generates SQL INSERT statements that can be saved to .sql files for easy import into any environment, as shown in the usage snippets for simple and complex associations.
Offers :ignore or :override strategies for duplicate key conflicts during import, with specific SQL syntax for MySQL, detailed in the advanced usage section.
Allows scrambling of fields like emails to prevent accidental side effects, with support for custom lambda functions for advanced transformations, as explained in the obfuscation examples.
The on_duplicate feature is currently only supported for MySQL databases, limiting utility for PostgreSQL or SQLite users, as admitted in the README with a call for PRs.
Polo's obfuscation is not secure and easily reversible, making it unsuitable for high-sensitivity data, as warned in the documentation that it's not a security feature.
Requires explicit whitelisting of associations and setup for obfuscation, which can be tedious for complex models with many relationships, without built-in automation.