One of our models is connecting to a warehouse DB since it's for reporting and not to serve the app features.
That model is based on a materialized view.
When refreshing, we currently can't use Scenic.database to connect to the database because it defaults to the main DB (it seems).
It's not a major issue since we can simply use the connection from the model, but I am wondering if scenic supports this and I am missing something or if it doesn't.
# In one of my models
def self.refresh
Scenic.database.refresh_materialized_view(table_name,
concurrently: false,
cascade: false)
end
Instead we have to do this workaround which works fine, but I wonder if there is a better way?
def self.refresh
connection.execute("REFRESH MATERIALIZED VIEW #{table_name};")
end
One of our models is connecting to a warehouse DB since it's for reporting and not to serve the app features.
That model is based on a materialized view.
When refreshing, we currently can't use
Scenic.databaseto connect to the database because it defaults to the main DB (it seems).It's not a major issue since we can simply use the connection from the model, but I am wondering if scenic supports this and I am missing something or if it doesn't.
Instead we have to do this workaround which works fine, but I wonder if there is a better way?