What are Locations?
A location is a logical mapping of a database and a schema. Locations are assigned to objects in a Tx project to point to them in a given database environment. Using locations and location mappings across environments allows Tx projects to be deployed to different environments without requiring code changes.
Every Tx project has a default location. This default location cannot be deleted, although additional locations can be added.
Locations (names) are global to the project and shared among project users.
The location mapping is personal to each user to allow them to work in common or personal schemas.
Benefits of Locations
Consistent object management: Every Tx object must have a location to be identifiable within the database.
Ease of deployment: Tx objects linked to a location can be moved across environments without requiring code changes since the location mappings are maintained per environment and fully qualified names are only compiled at runtime.
Setting Up a Storage Location
Initial Setup
When configuring the User Connection and linking it to a Transformational project, a Default Location called "My Location" is automatically created.
Modifying Existing Locations
- Click on the blue SqlDBM menu at the top left of the screen.
- Select "Settings and conventions"
- Next, select "Storage locations"
- A list of available Locations will be shown.
- Here, the Name, Database, and Schema can be modified.
- Alternatively, new Locations can be configured.
Default Location
Objects and templates will use the default location if no specific location is defined or the original location is deleted.
- The default location can be changed if multiple locations are available.
- There must always be at least one location designated as default.
Working with locations in Jinja
Locations are saved as part of projects and environments. Locations and their attributes (e.g., name, database, schema) can be referenced within a Tx Object through Jinja. The following attributes can be referenced:
name - the name of the location defined for a given Tx Object
databaseName - the database mapping defined for this Object's Location
schemaName - the schema mapping defined for this Object's Location
mapping - a concatenation (though a period["."]) of the database and schema. Equivalent to
{{ location.databaseName }}.{{ location.schemaName }}
Jinja examples
The following examples reference a Tx Object called MyObject
which uses a location SRC
, mapped to database dev
and schema raw
.
The following Jinja snippet:
{{location.name}}
{{location.databaseName}}
{{location.schemaName}}
{{location.mapping}}
{{name}} /* object name */
{{ location.databaseName }}.{{ location.schemaName }}.{{name}}
{{this}} /* don't forget about this */
Compiles to:
SRC
dev
raw
dev.raw
MyObject /* object name */
dev.raw.myObject
dev.raw.myObject /* don't forget about this */
See also: