When a database is targeted that is different from the one specified in the profile, the insert_by_period materialization is not taking the database name into account when calling get_period_boundaries.
Additionally, get_period_boundaries is quoting the relation parts and therefore resulting in "object does not exist" error.
get_period_boundaries should have a database argument that is passed from the insert_by_period materialization.
insert_by_period should apply "upper" to the database, schema and identifier or apply "upper" in get_period_boundaries before building the "from" clause where the relation parts are quoted.
When a database is targeted that is different from the one specified in the profile, the insert_by_period materialization is not taking the database name into account when calling get_period_boundaries.
Additionally, get_period_boundaries is quoting the relation parts and therefore resulting in "object does not exist" error.