post https://api.sigmacomputing.com/v2/dataModels//swapSources
Swap the data sources used by a data model. You can swap from one connection to another, and/or from one dataset or table to another.
Usage notes
-
Retrieve the dataModelId by calling the /v2/dataModels endpoint.
-
Retrieve the connectionId by calling the /v2/connections endpoint.
-
To map the sources of a specific element, you can use the table or dataset ID:
- List sources of data model by calling the /v2/dataModels/{dataModelId}/sources endpoint.
- Retrieve table and dataset IDs by calling the /v2/files endpoint. Use the
typeFiltersoption to filter for table and dataset files. Useidfield in the response as thefromIdortoId, as relevant.
-
To swap all tables in a connection, set the
swapTablesoption totrue.- Use the
pathsoption to specify the connection paths to swap. The connection path is a list of strings that represents the path to the table in the cloud data warehouse. For example,["database", "schema", "table"]. - If the table schema is the same in both connections, leave the
pathsoption empty to swap all tables in the connection. You can also pass a partial path to swap between databases, catalogs, or schemas. - If
sourceMappingis provided, those mappings take precedence over the connection swaps. - If
swapTablesis not set totrue, only Custom SQL elements have their connections changed.
- Use the
Usage scenarios
- Data model development: Use a test data source while developing a data model, then swap the source to a production database when ready to share the data model for production use.
