> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Testing migration of production data in a development project

> Replicate production data to a development CDF project so you can test a migration command before running it in production.

<Warning>
  The migration plugin is an experimental feature. Updates to the Cognite Toolkit are likely to introduce changes to the described commands and processes.
</Warning>

Migrating from an asset-centric to a data modeling-based CDF project is a significant change. Try the migration process in a development CDF project before running it in production. To do this, take a snapshot of the data and configuration in your production CDF project and restore it to a development CDF project.

You can use the [Cognite Toolkit data plugin](/cdf/deploy/cdf_toolkit/guides/plugins/data_plugin/index) for this.
It is designed such that when you download data, you can use the same format to upload it again. The download will
also include any configurations that you need, for example, if you download assets or events, the download will
include data set and label resource configuration YAML files. These can then be deployed as part of the upload process
(by using the `--deploy-resources` flag).

## Replicate production data

To replicate production data to a development CDF project:

<Steps>
  <Step title="Get read access to production">
    You need read access to the data and configurations you will copy from the production CDF project.
  </Step>

  <Step title="Download production data">
    See [Download data](/cdf/deploy/cdf_toolkit/guides/plugins/data_plugin/download#supported-data-types) for supported data types. Download into a local folder, for example `data`. This can include assets, events, time series (with datapoints), files (with file content), Charts, Canvas, and 3D models.

    Store production credentials in a `.env` file and pass it with `--env-path`. For example, to download an asset hierarchy:

    ```bash theme={"languages":{"custom":["/_languages/kuiper.json","../_languages/kuiper.json"]}}
    cdf --env-path prod.env data download hierarchy
    ```

    After the download completes, you will have a folder structure like this:

    ```shell wrap theme={"languages":{"custom":["/_languages/kuiper.json","../_languages/kuiper.json"]}}
    data/
      resources/                  # Optional, only if deploy_resources is True
        raw/
          table1.Table.yaml
          table2.Table.yaml

      datafile1.<kind>.ndjson     # Data file of a specific kind
      datafile1.Manifest.yaml     # Manifest for datafile1

      datafile2-part-0001.<kind2>.ndjson   # Another data file
      datafile2-part-0002.<kind2>.ndjson   # Part 2 of data file
      datafile2.Manifest.yaml     # Manifest file for datafile2
    ```
  </Step>

  <Step title="Upload the data to the development project">
    Store development credentials in another `.env` file, for example `dev.env`. Upload the local `data` folder:

    ```bash theme={"languages":{"custom":["/_languages/kuiper.json","../_languages/kuiper.json"]}}
    cdf --env-path dev.env data upload dir data/ --deploy-resources
    ```

    With `--deploy-resources`, the Cognite Toolkit first deploys any configurations in the `resources/` folder, then uploads the data.
  </Step>

  <Step title="Verify the copy">
    Confirm that the expected assets, events, files, time series, and application configurations exist in the development project before you run a migration command.
  </Step>
</Steps>

With production data now available in your development CDF project, you can safely test the migration process.

## Further reading

* [Migration overview](/cdf/deploy/cdf_toolkit/guides/plugins/migration_plugin/steps)
* [Using the data plugin](/cdf/deploy/cdf_toolkit/guides/plugins/data_plugin/index)
