Search code examples
csvmarklogicdocumentmarklogic-9data-ingestion

How to add a column in marklogic during ingestion?


I have a CSV which I'm loading through mlcp. How to add a column with one string value of my choice during ingestion? What transform functions to use and how?


EDIT: I will be using JS to write transformations. The basic workflow is:

  1. Write and load the JS transform into modules db using query console/curl.

  2. Call the transformation func with mlcp while loading the data from CSV which then gets converted to JSON documents into contents db.


Solution

  • There's a bit more to this concept than can be answered so generally on Stack. I strongly recommend reading the section on transforming data on ingest in the MLCP users guide. You would write a custom transform in a main module that would run against the content of the record being imported. The details you are looking for in you broad question are dependent on what you're trying to accomplish and what development language you are using. You'll have better success getting guidance with more specific questions that may arise after you check this out.

    https://docs.marklogic.com/guide/mlcp/import#id_82518

    HTH, Harry