python - Why standard NDB query returns different result compared to GQL query? -


I use the following code to calculate the number of institutions:

  def get_emails_count (email_type = none, yesterday = none, status = none): email = EmailQueue.query () if email_type: email = emails.filter (EmailQueue.email_type == email_type) if tomorrow: ... : Email = emails.filter (EmailQueue .status == status) Email = emails.count (keys_only = true) Return email get_emails_count (email_type = 4, status = 0)   

and the following GQL Query (used on the GAE console):

  SELECT __key__ on the e-mail Where email_type = 4 and status = 0   

gives the first code 245, the second one gives 5 instances (which is more visible to the right thing). What's wrong with the first code?

Be careful about the use of any comparison:

  If Status: Email = Email Filter (EmailQueue.status == position)   

Note that if 0: is evaluated by false . Instead, you should write:

  If there is no status: email = email .filter (emailcu.status == status)    < / html>

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -