0

Pycharm step through

With the following code:

oDth = Dth.objects.filter(dth_field_label__istartswith=tSearch, dth_languange='1')
    for j in oDth:
        tResult = tResult+ j.dth_ref + '</br>'

When debugging and stepping through we get 3 hits to the database:

2011-11-03 09:50:48 MST: LOG:  statement: SELECT "dth"."dth_key", "dth"."dth_ref", "dth"."dth_help_text", "dth"."dth_languange", "dth"."dth_field_label", "dth"."dth_sid", "dth"."dth_type" FROM "dth" WHERE ("dth"."dth_languange" = 1  AND UPPER("dth"."dth_field_label"::text) LIKE UPPER('hi%') ) LIMIT 21
2011-11-03 09:50:49 MST: LOG:  statement: SELECT "dth"."dth_key", "dth"."dth_ref", "dth"."dth_help_text", "dth"."dth_languange", "dth"."dth_field_label", "dth"."dth_sid", "dth"."dth_type" FROM "dth" WHERE ("dth"."dth_languange" = 1  AND UPPER("dth"."dth_field_label"::text) LIKE UPPER('hi%') ) LIMIT 21
2011-11-03 09:50:49 MST: LOG:  statement: SELECT "dth"."dth_key", "dth"."dth_ref", "dth"."dth_help_text", "dth"."dth_languange", "dth"."dth_field_label", "dth"."dth_sid", "dth"."dth_type" FROM "dth" WHERE ("dth"."dth_languange" = 1  AND UPPER("dth"."dth_field_label"::text) LIKE UPPER('hi%') )

But if we let it go at once we just get one:

2011-11-03 09:51:40 MST: LOG:  statement: SELECT "dth"."dth_key", "dth"."dth_ref", "dth"."dth_help_text", "dth"."dth_languange", "dth"."dth_field_label", "dth"."dth_sid", "dth"."dth_type" FROM "dth" WHERE ("dth"."dth_languange" = 1  AND UPPER("dth"."dth_field_label"::text) LIKE UPPER('hi%') )

Can someone help us figure out why the hits to the database are not consistent while running the same code?

2 comments

Please sign in to leave a comment.