Hi,
I am working to setup postgres adapter with ecto on Amazon Aurora. So i have writer and read databases. So i would like to use read_replica for report generations and extend my services for different activities in future.
Planning that, I wanted my application to start Dynamic Repo, connecting to databases in runtime(based on configuration during node startup). So instead of using dynamic repos approach, I am trying to compile at runtime, the read_repos during application startup.
Code.compile_string(“defmodule #{repo} do \n use Ecto.Repo, otp_app: :web_api, adapter: Ecto.Adapters.Postgres, read_only: true \nend”(h))
and attaching the module repo in the supervisor.
This looks simple. But what could be the complication in following this approach?.
Thanks in advance.