$ show ankane/blazer
Blazer is a mountable Rails engine that turns any application into a business intelligence tool. It allows users to write and execute SQL queries against 20+ database adapters (PostgreSQL, MySQL, BigQuery, Athena, Snowflake, etc.), visualize results as charts (line, bar, pie, scatter, maps), create dashboards with multiple queries, and set up periodic checks with email/Slack alerts. The system also supports CSV uploads, cohort analysis, anomaly detection (via optional Prophet/Trend), and forecasting. Queries are logged for auditing, and results can be cached. Architecture follows the Rails Engine pattern with its own controllers, views, models, and assets. It is highly configurable via a YAML config file and extensible through registration patterns for adapters, notifiers, check types, anomaly detectors, and forecasters.
The LLM identified 4 files worth highlighting for reuse:
Defines the abstract interface for all database adapters, including methods for running statements, quoting, parameter binding, listing tables/schemas, and cancelling queries. Each of the 20+ concrete adapters (e.g., SqlAdapter, PrestoAdapter, ClickhouseAdapter) implements this interface. The pattern is clean and could be extracted to support any multi-database Ruby application with minimal adaptation.
Handles parsing and binding of user-defined variables in SQL statements. Supports smart variables (dropdowns from SQL or static lists), linked columns, smart columns, default values, and transformation lambdas. The module is self-contained and can be reused independently in any application that needs secure, dynamic SQL construction.
Implements a statement-based caching mechanism using SHA-256 hashing of the SQL, variables, and data source. Supports configurable expiry and optional run-based key uniqueness. The class is isolated and could be extracted for caching any expensive computation in a Ruby app.
Provides a registration system for different check alert types (e.g., bad data, missing data, anomaly detection). Uses a simple registry hash and allows external gems to add custom check types. This pattern is reusable for any plugin-based extensibility system in Ruby.