Skip to content

A CLI that allows you to quickly scaffold a Common Data Model (CDM) folder using either an existing relational database or plain SQL DDL.

License

Notifications You must be signed in to change notification settings

allantargino/sql2cdm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A CLI that allows you to quickly scaffold a Common Data Model (CDM) folder using either an existing relational database or plain SQL DDL.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published