Using generators in Django
Hi Devs, A quick question. I am using Django to schedule some commands to populate my PostgreSQL(Apart from using it as a web framework). I am currently fetching records from a particular table and for each of those records doing some calculation and storing the processed data in some other database. The skeleton code looks like this ``` ... def fetch_needs(project_id): for item in MyNeedsModel.filter(project_id=project_id).all(): yield item ... class Command(django.core.management.base.BaseCommand): def add_argument(self, parser): ... def handler(self, *args, **kwargs): project = (args[0], args[1]) project_id = MyProject.filter(...).id for need in fetch_needs(project_id): ``` I need to know whether the use of generators is correct here, in the sense that would it have any performance issues. The point that I am having trouble understanding is a comment on my code review. Also don’t use generator you are bypassing django inbuilt caching > mechanism. Using integrator it will create another list and get them one by > one Any help would be appreciated. Thanks, onlinejudge95 -- https://mail.python.org/mailman/listinfo/python-list
Understanding of GIL
Hi Devs, I am currently writing some custom Django commands for data updation, my workflow is like Fetch data from *PostgreSQL*. Call *Elasticsearch* for searching based on the data fetched from *PostgreSQL*. Query *PostgreSQL* and do an upsert behavior. I am using pandas data frame to hold my data during processing. The host we are using to run this jobs has a *CPython* interpreter as given by `platform.python_implementation()` I want to confirm whether *multithreading* would be a better choice here, given the fact that GIL is the biggest blocker(I agree it has to be there) for the same in CPython interpreters. In case further information is required do let me know. Thanks onlinejudge95 -- https://mail.python.org/mailman/listinfo/python-list
Re: Interpreter Python 3.8 not there to select from PyCharm
On Tue, Feb 18, 2020 at 1:40 AM Maxime Albi wrote: > I'm very new to Python and wanting to learn the basics. > I downloaded and installed Python 3.8 and PyCharm for my Windows 10 > machine. All good. > > Launched PyCharm and I started a new Project and tried to select an > 'interpreter' such as Python 3.8 but no interpreter was available for me to > select from the down arrow menu ..!?!? > > Any settings I need to do ?? > PyCharm community would be a better source for asking this question > > Thanks, > Maxime > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list