add a unique field in csv and
*class AutocompleteView(APIView): def __init__(self): self.keys = [] with open("search_terms_converteds.csv",'r') as file: reader = csv.reader(file) for row in reader:* * if row.get("perticular unique id field").exist():* * print("row already exist")* * else: self.keys.append(row[1]) print("constructor execution") global t t = Trie() t.formTrie(self.keys) def post(self,request): key = request.data print("key:",key) suggested_word = t.printAutoSuggestions(key) return Response(suggested_word, status = status.HTTP_200_OK)* On Mon, Feb 17, 2020 at 7:49 PM Soumen Khatua <soumenkhatua...@gmail.com> wrote: > Could you send me any code snippet or any link,Please? > > Thank you for your response > > > > On Mon, Feb 17, 2020 at 7:40 PM tribhuvan kishor < > tribhuvankishor...@gmail.com> wrote: > >> unique field in CSV >> >> On Mon, Feb 17, 2020 at 7:40 PM tribhuvan kishor < >> tribhuvankishor...@gmail.com> wrote: >> >>> i faced the same problem while i was dealing with CSV file. >>> i gave a unique file in csv to make a check on the particular entry. by >>> this way, i avoided multiple entries in my database >>> >>> >>> On Mon, Feb 17, 2020 at 7:30 PM Soumen Khatua <soumenkhatua...@gmail.com> >>> wrote: >>> >>>> Yeah, I'm trying to do it in your way but somehow it's not working in >>>> my script. >>>> >>>> Thanks for your valuable time. >>>> >>>> On Mon, Feb 17, 2020 at 7:27 PM Kasper Laudrup <laud...@stacktrace.dk> >>>> wrote: >>>> >>>>> Hi Soumen, >>>>> >>>>> On 17/02/2020 14.51, Soumen Khatua wrote: >>>>> > Okay. >>>>> > Is it possible to load the csv file one time do the POST or any >>>>> request >>>>> > multiple times without loading the same file.Of course If it is in >>>>> same >>>>> > class?? >>>>> > >>>>> >>>>> Yes, I just gave you some ideas on how that could be done. >>>>> >>>>> Kind regards, >>>>> >>>>> Kasper Laudrup >>>>> >>>>> -- >>>>> 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+unsubscr...@googlegroups.com. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/django-users/7dc857eb-eea2-73d0-f7e6-71af08efcd7f%40stacktrace.dk >>>>> . >>>>> >>>> -- >>>> 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+unsubscr...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/django-users/CAPUw6Wa392ghVCSkMfcgpf2AAMSaTXGHNKukX1KjWNx1Getr-g%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/django-users/CAPUw6Wa392ghVCSkMfcgpf2AAMSaTXGHNKukX1KjWNx1Getr-g%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> >>> >>> -- >>> regards >>> Tribhuvan Kishor Bhaskar >>> 9818078761 >>> >> >> >> -- >> regards >> Tribhuvan Kishor Bhaskar >> 9818078761 >> >> -- >> 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+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/CACiphSVOXD9CXdio0qcFWjA03SJt8DuOF5cc7ou6KF8qYwJs9g%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-users/CACiphSVOXD9CXdio0qcFWjA03SJt8DuOF5cc7ou6KF8qYwJs9g%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CAPUw6Wa8r%2BhLykaW6WTgOq6wrZZ_Q0UxCZW14mxs74yKoJGugQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CAPUw6Wa8r%2BhLykaW6WTgOq6wrZZ_Q0UxCZW14mxs74yKoJGugQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- regards Tribhuvan Kishor Bhaskar 9818078761 -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACiphSUJU1pVDO2ykXCb-xYs2BSEdydAg61CC9wfCr5X3Pqbmw%40mail.gmail.com.