Hello,
So I have this materialized view that contains the same fields as my table with extra conditions:
CREATE MATERIALIZED VIEW searchable_certifications AS (
SELECT * FROM certifications
WHERE certifications.is_active
AND EXISTS (
SELECT null FROM delegates
INNER JOIN certifications_delegates
ON delegates.id = certifications_delegates.delegate_id
WHERE delegates.is_active
AND certifications_delegates.certification_id = ?
)
)
I would like to query this materialized view easily.
What would be a best practice?
If I go for from(c in "searchable_certifications")
I get the error:
** (Ecto.QueryError) expected a from expression with a schema in query:
So either I should create a SearchableCertification
model but then how do I share the schema with the Certification
model?
Or I should tell the query that the schema is from Certification
. Can I?
Thanks