Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.67 KB

README.md

File metadata and controls

62 lines (43 loc) · 1.67 KB

sql2cdm

Overview

This project allows you to quickly scaffold a Common Data Model (CDM) folder using SQL DDL and custom annotations in form of SQL comments:

CREATE TABLE Customer
(
	CUSTOMER_ID INT IDENTITY(1,1) PRIMARY KEY,
	CUSTOMER_NAME VARCHAR(50) NOT NULL /* {trait:means.fullname} */
);

CREATE TABLE CustomerAddresses
(
	CUSTOMER_ADDRESS_ID INT IDENTITY(1,1) PRIMARY KEY /* {trait:means.identity; trait:is.dataFormat.integer} */,
	CUSTOMER_ID INT NOT NULL,
	ADDRESS VARCHAR(100) NOT NULL /* {trait:means.address.main} */,

	FOREIGN KEY(CUSTOMER_ID) REFERENCES Customer(CUSTOMER_ID)
);

CREATE TABLE VipCustomer /* {extends:Customer} */(
	SPECIAL_CARD_NUMBER CHAR(10) NOT NULL
);
sql2cdm -i /sql/customer.sql -o ./cdm-generated

Quick Start

Requirements

Steps

  1. Clone this repository on your machine.

  2. Build and publish the project:

dotnet restore --interactive
dotnet publish --no-restore ./src/Sql2Cdm.CLI -o ./cli

If you have problems with NuGet authentication, please check this document.

  1. Run the CLI using customer.sql sample:
dotnet ./cli/Sql2Cdm.CLI.dll -i ./sql/customer.sql -o ./cdm-generated

Additional Documentation