Hanging SyncConsumers taking down ASGI processing

2023-04-28 Thread Tim Nelson
I am chasing a database deadlock issue in my application. What appears to be happening is my SyncConsumers are eating up all the ASGI threads because they are hung and websocket connections start failing. Is there a way to add a uWSGI "harakiri" like functionality to SyncConsumers to defend agains

Re: Import [python django module] could not be resolved from source Pylance (reportMissingModuleSource) -- even though Django is installed in my venv

2023-04-28 Thread Emalexogah Ogah
If you felt the problem was vs code, I have a suggestion. Try it out and if it works, get back to me. Open your comman prompt terminal and input Python -m venv venv (press enter) Venv/static/activate (press enter) Then install django again On Fri, Apr 28, 2023, 3:27 AM Michael Starr wrote: > Tha

Django ORM: move filter after annotate subquery

2023-04-28 Thread Aivan Fouren
This Django ORM statement: Model.objects.all() \ .annotate( ord=Window( expression=RowNumber(), partition_by=F('related_id'), order_by=[F("date_created").desc()] ) \ .filter(ord=1) \ .filter(date_created__lte=some_datetime) Leads to the following SQL query: SELECT * FROM

Re: Django ORM: move filter after annotate subquery

2023-04-28 Thread Aivan Fouren
I found a way to achieve the results I want: applying a filter, ` date_created__lte` in this example, outside of annotated query: sub = Model.objects.all() \ .annotate(ord=Window( expression=RowNumber(), partition_by=F('related_id'), order_by=[F('date_created').desc()] ) ) \ .fil

Re: Import [python django module] could not be resolved from source Pylance (reportMissingModuleSource) -- even though Django is installed in my venv

2023-04-28 Thread ALBERT ASHABA AHEEBWA
This is a wild suggestion, but as someone here mentioned, your vscode might be pointing to the wrong interpreter. Check at the bottom bar of your vscode with a .py file open. Next to {}python you should see what environment you are using. eg. 3.11.3 64-bit or 3.11.3('.venv':venv) The latter is w