DataLexicon
DataLexicon is a lightweight, model-driven tool for turning logical data models written in YAML into database-ready SQL, documentation, and ER diagrams.
It is designed for data engineers, analysts, and architects who want to define their data model once and generate consistent outputs for multiple database dialects.
Why DataLexicon?
DataLexicon helps teams:
- keep data models in version control
- generate SQL automatically from logical models
- standardize naming conventions and abbreviations
- generate documentation and ER diagrams
- support multiple dialects such as PostgreSQL, SQL Server, Oracle, and Snowflake
Key features
- YAML-based logical modeling
- Generate SQL DDL for multiple dialects
- Primary key, foreign key, and index generation
- Table and column comments from model descriptions
- Naming configuration via standards/naming.yml
- Docs generation with HTML output and Mermaid ER diagrams
- Works well in Git-based workflows and CI/CD pipelines
How DataLexicon works
- Create a project folder.
- Place your logical models in a models directory as YAML files.
- Add a modelforge.yml file with your project settings.
- Optionally configure naming and abbreviations in a standards directory.
- Run the build command to generate SQL into the target folder.
- Run the docs command to create an HTML report with the ER diagram.
Suggested project structure
my-project/
models/
customer.yaml
order.yaml
country.yaml
standards/
naming.yml
abbreviations.yml
modelforge.yml
target/
Example model file
entity: Customer
description: Customer master data
attributes:
- name: CustomerId
type: identifier
required: true
primary_key: true
description: Unique customer identifier
- name: CustomerName
type: text
description: Customer display name
relationships:
- entity: Order
type: one-to-many
source_attribute: CustomerId
target_attribute: CustomerId
Minimal configuration
name: my_project
models_dir: models
standards_dir: standards
dialects:
- postgres
Naming configuration
You can customize primary key, foreign key, and index naming in standards/naming.yml:
naming:
primary_key:
prefix: PK_
suffix: _PK
foreign_key:
prefix: FK_
suffix: _FK
index:
prefix: IX_
suffix: _IDX
Commands
Build SQL
modelforge build .
This creates SQL files in the target folder per selected dialect.
Generate documentation
modelforge docs .
This creates HTML documentation with logical model sections, generated SQL, and an ER diagram.
Validate a model
modelforge validate models/customer.yaml
VS Code extension
The DataLexicon VS Code extension adds commands directly inside VS Code for building models and generating documentation from the open workspace.
License
DataLexicon is licensed under the MIT License.