Search code examples
gooddata

Creating metadata dynamically from a flat .csv file in CC


I am having some difficulties on how to dynamically create a metadata, which need to be extracted from the header line of a flat .csv file in CC.

Usually, I manually define the metadata by select New Metadata --> Extract from flat file in CC. However the metadata of the file may changes with additional columns. Thus, I do not know the metadata of the file and I can not define it in this static approach.

It would be helpful if you could suggest a solution to create metadata dynamically and using this newly created metadata for connecting to other components. Perhaps an example graph file for demonstration would be great.

Thanks, Andy


Solution

  • I have discovered this kind of solution.

    You just have to fill in flat .csv filename into csv readers and writers.

    1. MetaDataMaster.grf - runs the graphs below.
    2. MetaDataCreator.grf - creates metadata according to csv header and write it into meta_example.fmt file
    3. MetaDataUser.grf - Reads csv according to created meta_example.fmt file - you can add there a reformat and use just some predefined fields.

    You can run the 2nd and 3rd graph separately to test it.