Microsoft SQL Server - DataVault
Applies to
Platform: Microsoft SQL Server
Architecture: Data Vault
Microsoft SQL Server - DataVault generates a Stage, Raw Vault and Business Vault for SQL Server as T-SQL scripts with stored procedure loaders. Select the Generator Configuration Microsoft SQL Server DataVault when you add a project whose Data Vault runs on SQL Server. This article lists what the configuration supports.
Scope and output
- Platform: Microsoft SQL Server.
- Layers: Source, Stage, Raw Vault and Business Vault. Dataflow Modeling shows Stage in the Bronze column and both vault layers in the Silver column. See Understand the Layering concept.
- Output: the layer scripts
SQL\L010_Stage.sql,SQL\L020_Raw Vault.sqlandSQL\L030_Business Vault.sql, the load control scripts or an Airflow DAG, and the PowerShell 7 scripts that deploy and load, described in Microsoft SQL Server - Artifacts.
Prerequisites
- A SQL Server instance and a login that can create the databases, schemas and objects of the layers and the load control. Each layer script creates its database with the recovery model
SIMPLEand its schema when they are missing. - PowerShell 7 and sqlcmd on the machine that deploys.
The setup is described in Microsoft SQL Server - Target environment. The placeholders for the server, database and schema names are listed in Microsoft SQL Server - Placeholder values.
Sources and linked projects
Stage source views read each source table by its four-part name [<server>].[<database>].[<schema>].[<table>]. The server name stays empty for a source database on the same instance; otherwise it is the name of a linked server. The discovery types are listed in Source Systems per Generator Configurations, and Discover a Microsoft SQL Server database creates source model objects from a SQL Server database.
You can import a linked project as a source and export this project as a linked project.
Supported model objects
Source and Stage
Raw Vault
- Hub
- Link
- Satellite
- Link Satellite
- Multi-Active Satellite
- Same As Link
- Hierarchical Link
- Driving Key Link
- Record Tracking Satellite
- Effectivity Satellite
- Record Tracking Link Satellite
- Effectivity Link Satellite
- Non-Historized Link Satellite
- Non-Historized Satellite (no article yet), since Generator 2.4
- PIT
- Reference Table
- RawVault Composite
- Current View
- History View
Business Vault
- Business Hub
- Business Link
- Business Satellite
- Business Link Satellite
- Same As Business Link
- Hierarchical Business Link
- Business Driving Key Link
- Effectivity Business Satellite
- Record Tracking Business Link Satellite
- Effectivity Business Link Satellite
- Non-Historized Business Link Satellite
- Non-Historized Business Satellite (no article yet), since Generator 2.4
- Business PIT
- BusinessVault Composite
- Business Current View
- Business History View
- Hierarchy Flatten
- Vault Out, since Generator 2.2
Capabilities and limitations
- Keys: Hubs and Links have their hash key as primary key and a unique constraint
UC_<table name>on the business key terms. Primary keys are clustered. When a model object has a user-defined clustered index, its primary key is nonclustered and validation reports a warning. - Foreign keys: Foreign Key Mode offers
None,Create Disabled(default) andCreate Enforced.Create Disabledadds the constraint and disables it withNOCHECK CONSTRAINT. - Indexes: the deployment creates a nonclustered index
IX_<table name>_<related object>on the hash key of each relationship. Index management offers clustered and nonclustered rowstore and columnstore indexes, unique indexes and Included Columns. - Unknown member: the deployment adds a row with the hash key
0x00and the source systemUnknownto Hubs, Links, Satellites, Link Satellites and Multi-Active Satellites. Custom Singleton Values sets its values. - Hashing: hash keys and row hashes are
HASHBYTES('SHA1', ...)with the default Hash Algorithm, cast toVARBINARY(20)and stored inBINARY(20)columns. See How biGENIUS-X builds hash values. - Validity: with Persist Validity off, historized tables have no
BG_ValidToTimestampcolumn. The result view computes it from theBG_ValidFromTimestampof the next version. - Change detection: with Excluded from Delta Detection, changes to the selected terms of a Satellite alone create no new version.
- Loading order: Use Embryo Loader on a relationship adds a loader that inserts missing keys into the related Hub or Link before the Satellite loader runs.
- Data quality: data quality rules are available.
- Deployment: with the default Deployment Options, each deployment drops and creates the tables again. See Microsoft SQL Server - Deployment.
- Loading: LoadControl Options offers
Native Load ControlandAirflow.
Project properties
The configuration offers these project properties, with their defaults:
- Hash Algorithm:
SHA1; alsoSHA2_256andMD5 - Hash Casing:
None; alsoUpperandLower - Hash Concatenation Separator:
_ - Hash Null Placeholder:
_NULL_ - Hash Trim: off
- Begin of Universe:
19000101 - End of Universe:
99991231 - Persist Validity: off
- Create Result Views: on
- Target Object Comment Type:
None; alsoTablesandTables and Views - Artifact Output Mode:
Layer Composites; alsoDeployment Objects - Deployment Options:
Generate Drop Table Statements - Configure LoadControl: on
- Deploy LoadControl: on
- LoadControl Options:
Native Load Control; alsoAirflow
Older projects can still show the legacy property Behaviour for Nulled Business Keys in Links; the data quality rules replace it, see Understand Data Quality rules overview.
Data types
The Default Terms get these SQL Server data types. DATETIMEOFFSET and DATETIME2 are written without precision, so SQL Server uses precision 7:
- Timestamps,
datetimeoffset:BG_LoadTimestamp,BG_UpdateTimestamp,BG_ValidFromTimestamp,BG_ValidToTimestamp,BG_EffectiveTimestamp,DVPIT_ForeignKey_LoadDate - Effectivity,
datetime2:BG_Effectivity_Begin,BG_Effectivity_End - Hash keys and row hashes,
binary(20):Hub_HK,Link_HK,DrivingKeyLink_HK,PIT_HK,DVLINK_ForeignKey_Identity,DVPIT_ForeignKey_Identity,BG_RowHash,BG_RowHashScd1,BG_RowHashScd2 - Text,
nvarchar:BG_SourceSystem,BG_DataflowNameandBG_DataflowSetNamewith length 255,BG_ErrorDescriptionwith 4000,BG_IncrementLoadStatuswith 20 - Numbers:
BG_ID,BG_ErrorCount,BG_Sequenceint;BG_DataQuality_IDbigint - Flags,
bit:BG_IsDeleted,BG_Appearance,BG_MAS_HubDifferenceFound BG_IncrementalFilter,BG_LowerThresholdandBG_UpperThreshold: the data type of the term that you map toBG_IncrementalFilter
Platform differences
These profiles compare their configuration with this one, including data types and properties:
Example
A Hub common_customer with the business key term CUSTOMER_ID generates this table. The excerpt shows the example schema rdv in place of the placeholder and adds line breaks:
CREATE TABLE [rdv].[RDV_HUB_common_customer] (
[BG_LoadTimestamp] DATETIMEOFFSET NOT NULL
,[Hub_HK] BINARY(20) NOT NULL
,[BG_SourceSystem] NVARCHAR(255) NULL
,[CUSTOMER_ID] INT NOT NULL
,CONSTRAINT [PK_RDV_HUB_common_customer]
PRIMARY KEY CLUSTERED ([Hub_HK])
,CONSTRAINT [UC_RDV_HUB_common_customer]
UNIQUE NONCLUSTERED ([CUSTOMER_ID])
)
;
The view RDV_HUB_common_customer_Hashing computes the hash key with the default hash properties:
CAST(HASHBYTES('SHA1', CAST('' AS VARCHAR(MAX))
+ ISNULL(CAST([CUSTOMER_ID] AS NVARCHAR(4000)), N'_NULL_'))
AS VARBINARY(20)) AS [Hub_HK]
The deployment inserts the unknown-member row with Hub_HK 0x00, and the result view RDV_HUB_common_customer_Result filters it out with WHERE [Hub_HK] <> 0x00.
Release differences
Project Settings shows the Generator Version of your project.
- Generator 2.2: Vault Out; the project properties Persist Validity, Create Result Views, Hash Casing, Hash Concatenation Separator, Hash Null Placeholder and Hash Trim; the model object property Increment Management Type; the relationship property Use Embryo Loader, see Embryo Loader.
- Generator 2.3: the model object property Custom Singleton Values.
- Generator 2.4: Non-Historized Satellite and Non-Historized Business Satellite; the model object property Excluded from Delta Detection.
- Generator 1.10: the project property Delta Detection. Generator 2.0 no longer offers it.
Related articles
- Previous:
- Microsoft SQL Server: Target environment
- Next: Generate artifacts, Replace the placeholders in the artifacts
- Microsoft SQL Server: Artifacts, Deployment, Load data - Native Load Control, Load data - Apache Airflow Load Control
- Reference: Foreign Key Mode (Model Object), Custom Singleton Values (Model Object), Excluded from Delta Detection (Model Object), Behaviour for Nulled Business Keys in Links (Project), Hash Algorithm (Project), Artifact Output Mode (Project), Deployment Options (Project), LoadControl Options (Project)
- Microsoft SQL Server: Placeholder values
- See also: Available Generator Configurations, Understand the Generator Configuration, Source Systems per Generator Configurations, Oracle - DataVault, Fabric Warehouse - DataVault
- Microsoft SQL Server: Stage, Data Store, DataVault and Mart, Datamart