I am working on a data pipeline that pulls document metadata from an electronic document management system (EDMS). The end goal is to visualize document statuses (overdue, submitted etc.) in a PowerBI dashboard. I use Python to make API calls to the EDMS, which returns an XML file with the metadata for each document. Since I dont want to download the metadata of ALL documents each time the pipeline runs, I first query the EDMS to get the document IDs of any documents which have been modified since the last pipeline run. I can then query the EDMS iterating through the list of modified document IDs.
My question is: how should I store the data returned by the API calls. My options (as i see them):
- Save each XML file separately. This makes it easy to overwrite files when the document metadata changes in future pipeline runs, but it does result in hundreds of thousands of indiviual XML files, which makes subsequent processing much slower (the infamous "tiny files problem").
- Store all the document metadata in a single combined XML file. This eliminates the tiny file problem, but does it mean that for each document that is modified, I have to run an XPath search to find the corresponding XML elements in the combined XML file to then update that section of the XML. I am guessing it might also cause memory issues?
- Store only the XML data of the modified files as a single XML file. I.e. overwrite a single XML file each pipeline run which stores the document metadata of all the modified documents. This is probably the easiest to implement, but it means we do not retain a raw data copy of the metadata of each document in the EDMS.
In a subsequent step the raw data is ingested into a relational database. What would be the best practice solution to this problem?