Rashmita Purkayastha
Rashmita Purkayastha

Reputation: 449

Import table content from one database of one environment and write to other environment using XQUERY transformation in MARKLOGIC

I am being asked to work on a POC which is -

import data from one database from one environment and import the data to another environment using XQuery transformation in MarkLogic.

I am not sure if that can be possible as I understand that XQuery is basically used to transform any data within tables in same environment. If the requirement is to import/export data to/from Marklogic , would not be the Marklogic Data Hub the only option? Or this can be achieved using XQuery too?

Upvotes: 0

Views: 44

Answers (1)

Mads Hansen
Mads Hansen

Reputation: 66783

There are many options for exporting and importing data.

If there is a LOT of data, then backup/restore, flexible replication, or MLCP copy or archive might be your best bet.

You can always move the data within an XQuery module. You can read the document (if executing on the source system, using fn:doc() or if pulling from a remote system, using the REST endpoints such as /v1/documents or v1/search) and then insert with xdmp:document-insert() or sending to /v1/documents using xdmp:http-* methods. If there are a ton of docs to move, you may want to orchestrate those actions with a batch tool, such as CoRB, and execute the XQuery module for each document in a separate transaction.

Upvotes: 0

Related Questions