This builds the correct query in terms of SQL (from what I can see in the tracer).
However I get error Query Error: no column found for name: A_barcode
MvB::find()
.find_with_related(MvA)
.filter(MvBColumn::Barcode.eq(gtin))
.stream_partial_model::<DatabaseConnection, MvBSearchModel, MvASearchModel>(&conn)
.await
My partial models:
#[derive(Debug, FromQueryResult, DerivePartialModel)]
#[sea_orm(entity = "Entity")]
pub struct MvBSearchModel {
pub barcode: String,
pub lbl_type: String,
}
and
#[derive(Debug, FromQueryResult, DerivePartialModel)]
#[sea_orm(entity = "Entity")]
pub struct MvASearchModel {
pub prod_art_id: i32,
pub prod_art_pub_uuid: Uuid,
pub lbl_status: String,
}
The query that gets built, again it's correct:
SELECT
"mv_b"."barcode",
"mv_b"."lbl_type",
"mv_a"."prod_art_id",
"mv_a"."prod_art_pub_uuid",
"mv_a"."lbl_status"
FROM "products"."mv_b"
LEFT JOIN "products"."mv_a" ON "mv_b"."prod_art_pvt_id" = "mv_a"."prod_art_pvt_id"
ORDER BY "mv_b"."prod_brcd_id" ASC
What is causing this error? Am I doing something wrong?
Try to refine your Select result by calling
into_modeland defining a new struct model annotated with theFromQueryResultattribute. More information: https://www.sea-ql.org/SeaORM/docs/advanced-query/custom-select/#handling-select-results