sharu
sharu

Reputation: 71

Passing input filenames into a MLCP Transformation module while ingestion

I have a set of delimitted text files stored in a directory in my local filesystem. I wanted to ingest all these delimitted text files into marklogic using mlcp.

While ingestion, I am performing some transformation on the input content, to create a new field in each of the ingested document whose value will be its source filename.The purpose of this is to classify the ingested documents according to different file sources. For this purpose I wanted to pass the input filename into the transformation module.

Is there any way I can do this?

Upvotes: 1

Views: 102

Answers (1)

grtjn
grtjn

Reputation: 20414

You can either:

  • invoke MLCP for each csv separately, and pass in the file name of the csv using -transform_param=$filename on the command-line somehow,
  • or (maybe easier), grab hold of the uri of each record inside the transform using map:get($content, "uri"), and extracting the original csv name out of that uri with string manipulation

HTH!

Upvotes: 2

Related Questions