Defining source overrides
You can override the default data server connections, catalogs, or schemas that the data module is based on. As a result, the module can dynamically switch to a different source (data server connection, schema, or catalog) at run time, without any intervention from a user.
Source overrides are supported only for data modules that are based on data servers. If you reference a data module in which override values are specified in another data module, the override values are maintained.
Dynamic source overrides are useful when the development, test, and production environments use different data server connections, schemas, or catalogs, or in a multi-tenant application where each tenant uses a different instance of the same database schema or catalog.
About this task
Use the Override property on a data server connection, schema, or catalog to specify the override values. The following screen capture shows the override properties for the sales schema:
The Override checkbox determines if the default value or the override value of the property is used. If the checkbox is selected, the specified override value is used. If the checkbox is clear, the default value is used.
The override value can be a string,
which is a name of a data server connection, schema, or catalog that exists in your data server, or
a macro. In a macro, you can use session parameters, such as
- From Team content, open your data module.
- Expand the Sources panel.
- From the source (schema or catalog) context menu , select Properties.
- On the General tab, scroll down to the
Advanced section, and expand this section.
The Override property is available for Data server connection, Schema, and Catalog.
- Select the Override checkbox, and click the
The override expression editor is displayed.
- Add the override value in the Expression area.
If the value is a simple string, type the string.
If the value is a macro, type the macro text within the macro tags
##. Comments that are associated with a macro must be included within the macro itself.
For example, the following macro is used to dynamically switch to another source when the data module is used in the development environment, testing environment, or production environment.
#let datasource = case $machine when 'Holst' then 'GOSLDW_DNB_DB2' /* this is the development machine */ when 'Scarlatti' then 'GOSLDW_DNB_MSSQL_TEST' /* this is the testing machine */ when 'Buxtehude' then 'GOSLDW_DNB_DB2_SECURED' /* this is the production machine */ else 'nothing' end; datasource #
In this example, the preview shows the value of
GOSLDW_DNB_DB2because the machine name is Holst. This is the override value for the data server connection.Note: If the database doesn't use catalogs, the default override value for Catalog is null. And if the database doesn't use schemas, the default override value for Schema is null.
Both the default values and the override values are stored in the data module, and persist from session to session. If you clear any of the Override checkboxes, the default value is restored and displayed. If you select the checkbox again, the override value is restored and displayed.
If you relink a schema or catalog, the override property values are removed from the data module. To restore these properties, click the undo button . However, consider whether you need to relink manually since the override properties allow you to relink dynamically.