Data Sources

Quick Summary

Data sources are like separate versions of tables that contain different data sets — typically, they are separated into live or production data, and test data. The advantage to using separate data sources is so when you are building or iterating on your backend functionality, your actual live data stays safe. All data sources share the same . They only differ by allowing different copies of the database records.

In Xano, data sources are essentially different sets of tables within your application's database. These data sources are crucial because they provide a way to separate the actual, live data that your business relies on from the data you use for testing or development purposes. This separation is beneficial as it ensures that any changes you make while testing new features do not affect the actual operational data.

Data sources typically have two main variants: live data and test data. You can have as many data sources as you'd like if additional separation makes sense for your backend. Live data is what your application uses in real-time—it’s the actual data that reflects real-world activities. In contrast, test data is used for experimentation and development, allowing developers to try out new features or changes without risking the integrity of the live data. By keeping these data sources distinct, Xano enables businesses to safely innovate and enhance their backend functionality without compromising the data they depend on every day.

Creating Data Sources

1

Access your data sources from the left-side navigation menu

2

Add a new data source from the panel that opens

3

Customize the new data source

Give it a name, and choose a distinct color to assign to the data source. The color assigned is important, as it is used throughout the Xano interface to remind you of the currently selected data source.

When you're done, click


Using Data Sources

Switching Data Sources

When you switch data sources, any action you take in Xano such as running and debugging a function stack will target the selected data source. It is recommended to use a test data source whenever possible to avoid accidentally impacting live application data.

Switch your data source at any time by clicking the data source indicator in the left-side navigation.

This does not impact your live application; only the work you are performing inside of Xano.

Setting a Data Source as Active

If you want your backend to use a different data source by default, select it from the data sources panel and choose . All future activity, unless otherwise specified using one of the alternative methods below, will use the active data source.

Targeting Specific Data Sources

When running function stacks in Xano or calling them externally, you can target a specific data source a number of ways. If you do not specify a data source, Xano will use the

1

Use the Set Data Source function

The Set Data Source function, located under Utility Functions, allows you to manually set a data source at any time. Any future database operations, such as reads and writes, will use the defined data source.

2

Send a data source header in your request

If you're calling one of your Xano APIs externally, you can specify the data source to use in the request headers.

The header to send is as follows. Replace 'test' with the name of the data source you wish to target.

X-Data-Source: test
3

Send a URL argument in your request

If you don't have the ability to modify the request headers but still want to specify the data source in an external request, you can use a URL argument.

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

Change the settings of the function stack

In some function stack types, such as background tasks, you can set the data source to target if you would like it to be different from the live data source.

Migrating Data Between Data Sources

1

Access the Migration panel

Click the data sources indicator and choose ⚙️ Manage Data Sources. In the panel that opens, click Migrate.

2

Select the source and destination data source.

3

Select the tables to migrate.

4

Confirm your changes to begin the migration.

You can check the progress of the migration via the indicator in the left-hand navigation. You'll also see a banner at the top of the screen once the migration has completed.

Last updated

Was this helpful?