From zmx94824 at gmail.com Tue Apr 23 14:21:39 2019 From: zmx94824 at gmail.com (Mengxi Zhang) Date: Tue, 23 Apr 2019 11:21:39 -0700 Subject: [Flask] Issue for unused import Message-ID: Hi, I was reading the Flask code and I found the import statement `from werkzeug.urls import url_join` in the file `flask/flask/blueprints.py` was not used. I tried to search `blueprints.url_join` from all github repo, and I could not find anything either. I also did a blame on it and it looked like the import was not used in the commit which added it either. What is more, according to my understanding, `blueprints` is for adding deferred functions and registering them later when being registered on the application. And it should not depend on the lower layer module `werkzeug`? I am pretty new to the area, please correct me if I am wrong. If the import is indeed unused, I would be honored to push my first fix in the repo. Thanks, Mengxi Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: From coreybrett at gmail.com Thu Apr 25 13:53:37 2019 From: coreybrett at gmail.com (Corey Boyle) Date: Thu, 25 Apr 2019 13:53:37 -0400 Subject: [Flask] full-text searching Message-ID: I'm curious what others are doing for full-text searching. I've looked at Flask-WhooshAlchemy and tried to get it working, but didn't have much luck with it. I could be wrong, but I don't think it's compatible with app factories, and it doesn't seem to be maintained anymore. I was able get flask-msearch working with a little effort and it seems like a possibility. I could follow the example given by Grinberg (https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-full-text-search) but I'd rather use a flask extension and keep my own code base as minimal as possible. Was hoping someone on the list would have some recommendations. From seandavi at gmail.com Thu Apr 25 14:10:56 2019 From: seandavi at gmail.com (Sean Davis) Date: Thu, 25 Apr 2019 14:10:56 -0400 Subject: [Flask] full-text searching In-Reply-To: References: Message-ID: Are you using a particular data store? On Thu, Apr 25, 2019 at 2:00 PM Corey Boyle wrote: > I'm curious what others are doing for full-text searching. > > I've looked at Flask-WhooshAlchemy and tried to get it working, but > didn't have much luck with it. I could be wrong, but I don't think > it's compatible with app factories, and it doesn't seem to be > maintained anymore. > > I was able get flask-msearch working with a little effort and it seems > like a possibility. > > I could follow the example given by Grinberg > ( > https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-full-text-search > ) > but I'd rather use a flask extension and keep my own code base as > minimal as possible. > > Was hoping someone on the list would have some recommendations. > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask > -- Sean Davis, MD, PhD Center for Cancer Research National Cancer Institute National Institutes of Health Bethesda, MD 20892 https://seandavi.github.io/ https://twitter.com/seandavis12 -------------- next part -------------- An HTML attachment was scrubbed... URL: From coreybrett at gmail.com Thu Apr 25 14:21:31 2019 From: coreybrett at gmail.com (Corey Boyle) Date: Thu, 25 Apr 2019 14:21:31 -0400 Subject: [Flask] full-text searching In-Reply-To: References: Message-ID: Flask-SQLAlchemy On Thu, Apr 25, 2019 at 2:11 PM Sean Davis wrote: > > Are you using a particular data store? > > On Thu, Apr 25, 2019 at 2:00 PM Corey Boyle wrote: >> >> I'm curious what others are doing for full-text searching. >> >> I've looked at Flask-WhooshAlchemy and tried to get it working, but >> didn't have much luck with it. I could be wrong, but I don't think >> it's compatible with app factories, and it doesn't seem to be >> maintained anymore. >> >> I was able get flask-msearch working with a little effort and it seems >> like a possibility. >> >> I could follow the example given by Grinberg >> (https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-full-text-search) >> but I'd rather use a flask extension and keep my own code base as >> minimal as possible. >> >> Was hoping someone on the list would have some recommendations. >> _______________________________________________ >> Flask mailing list >> Flask at python.org >> https://mail.python.org/mailman/listinfo/flask > > > > -- > Sean Davis, MD, PhD > Center for Cancer Research > National Cancer Institute > National Institutes of Health > Bethesda, MD 20892 > https://seandavi.github.io/ > https://twitter.com/seandavis12 From seandavi at gmail.com Thu Apr 25 14:34:05 2019 From: seandavi at gmail.com (Sean Davis) Date: Thu, 25 Apr 2019 14:34:05 -0400 Subject: [Flask] full-text searching In-Reply-To: References: Message-ID: If you are using postgres or sqlite, you may be able to push the full text search back into the database. Mysql may have similar capabilities at this point--not sure. Sean On Thu, Apr 25, 2019 at 2:22 PM Corey Boyle wrote: > Flask-SQLAlchemy > > On Thu, Apr 25, 2019 at 2:11 PM Sean Davis wrote: > > > > Are you using a particular data store? > > > > On Thu, Apr 25, 2019 at 2:00 PM Corey Boyle > wrote: > >> > >> I'm curious what others are doing for full-text searching. > >> > >> I've looked at Flask-WhooshAlchemy and tried to get it working, but > >> didn't have much luck with it. I could be wrong, but I don't think > >> it's compatible with app factories, and it doesn't seem to be > >> maintained anymore. > >> > >> I was able get flask-msearch working with a little effort and it seems > >> like a possibility. > >> > >> I could follow the example given by Grinberg > >> ( > https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-full-text-search > ) > >> but I'd rather use a flask extension and keep my own code base as > >> minimal as possible. > >> > >> Was hoping someone on the list would have some recommendations. > >> _______________________________________________ > >> Flask mailing list > >> Flask at python.org > >> https://mail.python.org/mailman/listinfo/flask > > > > > > > > -- > > Sean Davis, MD, PhD > > Center for Cancer Research > > National Cancer Institute > > National Institutes of Health > > Bethesda, MD 20892 > > https://seandavi.github.io/ > > https://twitter.com/seandavis12 > -- Sean Davis, MD, PhD Center for Cancer Research National Cancer Institute National Institutes of Health Bethesda, MD 20892 https://seandavi.github.io/ https://twitter.com/seandavis12 -------------- next part -------------- An HTML attachment was scrubbed... URL: From coreybrett at gmail.com Mon Apr 29 11:32:12 2019 From: coreybrett at gmail.com (Corey Boyle) Date: Mon, 29 Apr 2019 11:32:12 -0400 Subject: [Flask] Class attribute name of "id" for primary key in database models? Message-ID: There seems to be a common practice of using "id" for the attribute name of primary keys in database models. This has always bothered me a little because editors will often show "id" in a different color because it is a Python builtin. I know that it's a class attribute and therefore not technically overloading the builtin, but it still seems a little wrong to me. Is there some practical advantage to this practice? Could I just use "pk" instead of "id"? From jerry.mccreary at mac.com Mon Apr 29 12:06:04 2019 From: jerry.mccreary at mac.com (Jerry Mccreary) Date: Mon, 29 Apr 2019 12:06:04 -0400 Subject: [Flask] Class attribute name of "id" for primary key in database models? In-Reply-To: References: Message-ID: <6A7630BB-D826-4AC9-826A-6D4145DE4B14@mac.com> Using "id" isn't required (unless your database requires it). However, I've not encountered any problem using "id" as attribute. I use MongoDB a lot -- where the default primary key is "_id". The packages I use will convert "_id" to "id" when outputting to JSON. I would consider what it might affect downstream. For example, most of my data is output to JSON, where the objects are manipulated in Javascript, and the expected primary key is "id". > On Apr 29, 2019, at 11:32 AM, Corey Boyle wrote: > > There seems to be a common practice of using "id" for the attribute > name of primary keys in database models. This has always bothered me a > little because editors will often show "id" in a different color > because it is a Python builtin. I know that it's a class attribute and > therefore not technically overloading the builtin, but it still seems > a little wrong to me. Is there some practical advantage to this > practice? Could I just use "pk" instead of "id"? > _______________________________________________ > Flask mailing list > Flask at python.org > https://mail.python.org/mailman/listinfo/flask -------------- next part -------------- An HTML attachment was scrubbed... URL: