By enabling this feature, users with the required permission level can create Live Query components (charts, analytics charts and segments), allowing them to create more sophisticated requests to your database, by leveraging the underlying query language, SQL in this case.
You can enable this feature by setting a connection name (works as an identifier) when creating your datasource. This connection name will be reflected on the UI when configuring a Live Query component, it should have a clear meaning for your Forest users.
If a string is provided (e.g., main_database), ForestAdmin will bind it to the primary database as defined in your Ruby on Rails configuration.
If a hash is provided, it should be a mapping of {"primary" => "main_database"}.
Multi databases
If you are working with multiple databases, here is an example of how you can configure live queries to target specific connections for each database :
Understanding the configuration
keys (e.g., 'main_database', 'replica_database'): These are the display names that will appear in the Forest Admin UI when selecting a database for live queries.
values (e.g, 'primary', 'primary_replica'): These correspond to the connection names defined in your Rails application config/database.ymlfile. For example if your database.yml contains:
Then users will see "main_database" and "replica_database" as options in the Forest Admin interface, which will connect to primary and primary_replica respectively.