On Sunday 06 July 2008 21:33:49 Michael Bayer wrote:
> On Jul 6, 2008, at 12:21 PM, [EMAIL PROTECTED] wrote:
> > the query is ugly;
> > seems count(1) counts the decart-product or something:
> >
> > SA: INFO SELECT count(1) AS count_1
> > FROM "Otnoshenie", mm_nazn2rabmesto, mm_nazn2pozicia,
> > mm_pozicia2otdel,
> > mm_otdel2otdel AS mm_otdel2otdel, mm_otdel2otdel AS
> > mm_otdel2otdel1, mm_otdel2otdel AS mm_otdel2otdel2, "PVOwnership"
> > JOIN "ParamValue" ON "PVOwnership".param_value_id =
> > "ParamValue".db_id
> > WHERE "ParamValue".time_trans <= ? AND "ParamValue".time_valid >=
> > ? AND "ParamValue".time_valid <= ? AND ("Otnoshenie".db_id =
> > "PVOwnership"."_AbstractNaznachenie_id" OR "Otnoshenie".db_id =
> > mm_nazn2rabmesto.left_id AND mm_nazn2rabmesto.right_id
> > = "PVOwnership"."_Rabotno_miasto_id" OR "Otnoshenie".db_id =
> > mm_nazn2pozicia.left_id AND (mm_nazn2pozicia.right_id
> > = "PVOwnership"."_Pozicia_id" OR mm_nazn2pozicia.right_id =
> > mm_pozicia2otdel.left_id AND (mm_pozicia2otdel.right_id
> > = "PVOwnership"."_Otdel_id" OR mm_pozicia2otdel.right_id =
> > mm_otdel2otdel.left_id AND (mm_otdel2otdel.right_id
> > = "PVOwnership"."_Otdel_id" OR mm_otdel2otdel.right_id =
> > mm_otdel2otdel1.left_id AND (mm_otdel2otdel1.right_id
> > = "PVOwnership"."_Otdel_id" OR mm_otdel2otdel1.right_id =
> > mm_otdel2otdel2.left_id AND mm_otdel2otdel2.right_id
> > = "PVOwnership"."_Otdel_id"))))) AND "PVOwnership".param_value_id
> > = "ParamValue".db_id AND "Otnoshenie".obj_id_id = ?
> >
> > that's 3 levels: 4752
> > 4 levels: 14256
> > 5 levels: 42768
> > .. 8 levels: 1154736
> > while there are 57 rows total.
>
> I have no idea what that is.  Is that a bunch of join()/filter()
> you've added to the query before issuing count() ?  or are you
> mapped to a select() statement of that form ?  (either way I dont
> see what choice SA has in the matter...)
bunch of joins+filters, and at the end, i just did .count() instead 
of .all().
probably what u've suggested - count(query.class_.id), with or without 
distinct) makes more sense than the default count(1)...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to