Introduction
When working with multiple databases or environments, you may want to reuse the same table definitions and relationships (joins) across different data connections. Instead of recreating everything manually, you can export and import these elements using JSON files.
This guide provides step-by-step instructions on how to export tables and joins from one data connection and import them into another. This method ensures consistency, reduces manual work, and helps avoid configuration errors.
Prerequisites
Before you begin, make sure that:
- You have access to the system’s Manage Databases section.
- At least two data connections (source and target) are set up and accessible.
- You understand basic database concepts such as tables, joins, and views.
Step 1: Select the Default Data Connection
- Navigate to Manage Databases.
- Open the Data Connections tab.
- Identify the connection you want to work with (this will be your source connection).
- Click on it to set it as the default connection.
Setting a default connection ensures all table and join actions are performed using the selected data connection.
Step 2: Export Tables from the Source Data Connection
- Go to the Database Tables section.
- Browse the list of available tables.
- Select a table you want to export.
- Select Export as JSON to export the selected Table in JSON format.
- Save the file to your local machine.
Repeat this process for each table you wish to export.
Step 3: Export Joins from the Source Data Connection
- Navigate to the Relations tab.
- Click the Export Join associated with the tables.
- Save the generated JSON file.
The JSON file contains the metadata for the join, including the involved tables, join keys, and the join type.
Step 4: Switch to the Target Data Connection
- Return to Manage Databases.
- In the Data Connections tab, select your target connection.
This sets the target database connection as the current working context for importing tables and joins.
Step 5: Add or Import Tables in the Target Data Connection
You have two options for adding tables to the new data connection.
Option 1: Add Custom Tables Manually
- Go to the Custom Tables section.
- Click Add New Custom Table.
- Define the table manually, including the table name, columns, and data types.
Use this method for creating virtual tables or if you need full control over the structure.
Option 2: Import Existing Tables or Views
- Open the Database Tables section.
- Click Import Tables/Views.
- Upload the JSON file(s) you exported earlier.
The tables will be created in the new data connection based on the uploaded metadata.
Step 6: Import Joins into the Target Data Connection
- Navigate to the Relations tab.
- Click on Import Joins.
- Upload the join JSON files that were exported from the source connection.
This will recreate the relationships between the tables in the target environment.
Conclusion and Next Steps
By following the steps above, you have successfully migrated table and join definitions from one data connection to another. This approach helps ensure consistency across environments and saves time by avoiding repetitive manual setup.
With your tables and joins now established in the target connection, the next step is to begin building your reports:
- Navigate to your reporting module.
- Start creating visualizations or dashboards using the imported tables.
- Use the imported joins to combine data from related tables effectively.
- Validate your data outputs to ensure everything reflects the intended structure and logic.
This import/export process provides a foundation for scalable and maintainable reporting across multiple environments.