Doubt at ORM Django

0

I receive a csv daily which I import to Mariadb and clean the fields with SQL statements for example in the column mark if "SANSUN" comes with an UPDATE I correct it to "SAMSUNG" and so on with hundreds and hundreds of sentences until correct the whole file.

My intention is to give a web interface type CRUD to this task but I do not know how to approach it in Django. I'm stuck when I create the model and import the csv, the process of updating fields that I do currently in SQL I do not know if I have to do it in a view with all sentences of the ORM (python) of DJANGO grouped in a single view or some Another way?

    
asked by GUILLE MAX 15.03.2018 в 17:32
source

1 answer

0

I would first make an object "Corrections" that contains a word to substitute and a word by which it is substituted (if a regex is very complex) Which would keep me at the beginning in a dictionary so I do not have to ask the DB every time.

Then for each of the entries I would make a split of each of the words and for each of the words I would look for the coincidence of the dictionary key and if it exists (or passes the regex) I would replace it with the value.

This process would generate an object related to the table where you add the records now and once the values are replaced it would make a save for its persistence in BD

    
answered by 20.03.2018 в 16:03