Thursday, March 23, 2017

Re: Executing DB-Queries during import

Thank you tim for the link.

Since on the referenced discussion someone asked for help to debug this, I published my solution here: http://stackoverflow.com/questions/42972444/django-detect-module-level-db-queries/42972445#42972445

I think it would help if you get a RuntimeException if you access the db too early

Regards,
  Thomas

Am Mittwoch, 22. März 2017 19:20:43 UTC+1 schrieb Tim Graham:
Correct, module level queries should be avoided. Django might try to add some detection to warn about or prohibit that, see https://groups.google.com/d/topic/django-developers/7JwWatLfP44/discussion.

On Wednesday, March 22, 2017 at 12:16:16 PM UTC-4, guettli wrote:
If I recall correctly, then you should not execute db-queries during import.

I think this can do a lot of trouble. For example during test-discovery db-queries get executed.

Is it just me being paranoid, or is this a general advice?

I tried to find something about this topic with my favorite search engine, but failed.

What do you think?

Regards,
  Thomas Güttler

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/86ad75c1-550a-4704-99c1-a8cd455465b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment