Data Sources

Data sources refer to the different types of data environments available throughout a Xano workspace. For example, the Scale plan supports two environments for data sources: live (production) and test. Your live data source is the data that is live for your application. Test data source allows you to create test data with the same schema set up so that you can run tests without affecting your users' data.

Plans with data source environments: Scale and Enterprise

The Scale plan supports two data source environments: live and test. Enterprise supports multiple data source environments. To see more about each plan please visit pricing. In order to upgrade, navigate to billing within your account.

Adding and navigating a new data source environment

You can easily see which data source is active from the notifier in the left-hand panel. You can also click this to add new and switch to additional data sources.

Once you select the data source identifier button and click Manage Data Sources, you can click '+ Add Test Data Source' and be taken to the data source manager panel where you can add a new test environment. Each data source is represented by a color of your choosing.

Migrating Data Sets Between Data Sources

Once you have more than one data source available, you have the option to migrate data between them from the same panel. Migrating data to a data source will replace all existing data in the tables you are migrating to on the destination, so please keep that in mind before proceeding.

  1. Select the data source to migrate data from

  2. Select the data source to migrate data to

  3. Select the tables to migrate

  4. Confirm the migration

Make sure when choosing your tables to migrate that you include referenced tables, otherwise your destination data source will reference incorrect or missing data.

Important: Editing and Schema of Data Sources

It's important to note that a test data source will have exactly the same data schema and structure as your live environment. You cannot change, edit, or delete the schema or database tables in your test data source environment. The test environment allows you to use different data or records so that you can perform tests in your API without affecting your live data.

A test data source does not copy your live data. It has only the same schema so that you can add test or dummy data.

You are able to delete your test data source to easily start over. However, you cannot delete your live data source or change which data source is live and test.

When in a test data source environment, Xano will notify you throughout your workspace with a banner at the top of the page. You can easily switch back to live data at any time by select 'switch back' or 'change' in the database.

How to use the test Data Source with your API requests

Set Header Method

By default all API requests use the live data source, however, you can change that with the following HTTP header below. Use this header in your API requests to define the data source:

X-Data-Source: test

For Enterprise users that have multiple data sources available, you would change the word test with the correct name for your data source you want to use with your API request.

URL Argument Method

The other method to make API requests use the test data source is through a URL argument. You can append the argument to your API endpoint URL.

?x-data-source=test

https://x1xx-abcd-efgh.a1.xano.io/api:x123abc/user?x-data-source=test

This method is especially helpful for sending webhooks to your test data source when the webhook doesn't support additional headers.

Last updated