Discover this year's submissions to the Dataiku Frontrunner Awards and give kudos to your favorite use cases and success stories!READ MORE

Export DSS input files (csv or txt) into XML

Solved!
cbimou
Level 2
Level 2
Export DSS input files (csv or txt) into XML

Hi dear,

I need to output a dataset into an XML format.

Here my input file : people.csv

Id; firstname ; lastname ; age ;date

PERSONID1 ; LUNA;HUANG ;10 ;31/01/2022

PERSONID2 ; PATRICK;FALL;90 ;11/01/2012

PERSONID3 ; KENDAL;CASANOVA;90 ;12/06/2009

 

I want my output file look like this:

 

<?xml version="1.0"?>

<document date="2021-12-31">

<people filename="peoples.csv" people_id="PERSONID1">

<FIELD fieldname="firstname" value="LUNA"/>

<FIELD fieldname="lastname" value="HUANG"/>

<FIELD fieldname="age" value="10"/>

<FIELD fieldname="date" value="31/01/2022"/>

</people>

<people filename="people.csv " people_id="PERSONID2">

<FIELD fieldname="firstname" value="PATRICK"/>

<FIELD fieldname="lastname" value="FALL"/>

<FIELD fieldname="age" value="90"/>

<FIELD fieldname="date" value="11/01/2012"/>

</people>

<people filename="people.csv " people_id="PERSONID3">

<FIELD fieldname="firstname" value="KENDAL"/>

<FIELD fieldname="lastname" value="CASANOVA"/>

<FIELD fieldname="age" value="90"/>

<FIELD fieldname="date" value="12/06/2009"/>

</people>

</document>

 

 

I have tried this script (input.png)

 

the output I get does not suit me. It looks like this (output.png)

 

 

Is there any way to do this in DataIku?

0 Kudos
1 Solution
cbimou
Level 2
Level 2
Author

Hi @CoreyS 

 

Thanks for the suggestion. I finally found a solution by using folders as input for my flat file and as output for the xml. This way I get the Folder_IDs to easily use a python script to convert csv to xml.


Thanks

View solution in original post

2 Replies
CoreyS
Community Manager
Community Manager

Hi @cbimou while you wait for a more complete response, here are some resources you may find helpful

I hope this helps!

Looking for more resources to help you use Dataiku effectively and upskill your knowledge? Check out these great resources: Dataiku Academy | Documentation | Knowledge Base

A reply answered your question? Mark as ‘Accepted Solution’ to help others like you!
cbimou
Level 2
Level 2
Author

Hi @CoreyS 

 

Thanks for the suggestion. I finally found a solution by using folders as input for my flat file and as output for the xml. This way I get the Folder_IDs to easily use a python script to convert csv to xml.


Thanks