kadiks
kadiks

Reputation: 200

Import complex XML from multiple files in MariaDB

I can use connect engine xml on one file with all the nodes, but once I use several files with the same structure, I get this unusual response where all the rows have the same values:

filename | uid
 222.xml | 222
 223.xml | 222

I have reproduced the issue with a very simple structure.

This is the base XML file (222.xml):

<data>
  <uid>222</uid>
</data>

And the other (223.xml):

<data>
  <uid>223</uid>
</data>

And here is the SQL command I use:

CREATE TABLE `data` (
  filename VARCHAR(100) NOT NULL special=FILEID,
  uid char(10) field_format="uid"
)
engine=CONNECT
table_type=XML
file_name='data/*.xml'
multiple=1
option_list="rownode=data";

I have an external XML source which updates every week and I don't have control over its structure. That's why the connect engine is the most suitable solution for me.

I've followed this documentation: https://mariadb.com/kb/en/connect-xml-table-type/ and this tutorial: https://mariadb.org/crunching-xml-files-with-mariadb/ with no luck.

Upvotes: 0

Views: 464

Answers (1)

Olivier Bertrand
Olivier Bertrand

Reputation: 21

It is a bug indeed that will be fixed in future MariaDB releases.

Upvotes: 2

Related Questions