S
S
sortfact3332021-01-08 11:11:20
Django
sortfact333, 2021-01-08 11:11:20

How to add rows from xml document in django to db sql?

I have an xml document from someone else's site and I need to update my db
. But this is the first time I'm dealing with xml files and I don't know what models to create inside models.py, and how
to update them.
can someone explain to me how to do this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2021-01-08
@sortfact333

You read, look at examples of working with xml:
https://lxml.de/tutorial.html#the-parse-function
You understand, then go to your xml file.
You try on it.
Next, you create a view in which you parse the passed xml, according to the data model, then save it.
if the xml file is large, save it on the server and process it in a separate worker/thread.
By passing the filename through the queue.

I don’t know what models to create inside models.py, and how
to update them.

How do you not know what you were going to save in the database then?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question