Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MDL Basics

MDL (Mendix Definition Language) is a SQL-like language for reading and modifying Mendix application projects. It provides a text-based alternative to the visual editors in Mendix Studio Pro.

What MDL Looks Like

MDL uses familiar SQL-style syntax with Mendix-specific extensions. Here is a simple example that creates an entity with attributes:

CREATE PERSISTENT ENTITY Sales.Customer (
  CustomerId: AutoNumber NOT NULL UNIQUE DEFAULT 1,
  Name: String(200) NOT NULL,
  Email: String(200) UNIQUE,
  IsActive: Boolean DEFAULT TRUE
)
INDEX (Name);

Statement Termination

Statements are terminated with a semicolon (;) or a forward slash (/) on its own line (Oracle-style, useful for multi-line statements):

-- Semicolon terminator
CREATE MODULE OrderManagement;

-- Forward-slash terminator (useful for long statements)
CREATE PERSISTENT ENTITY Sales.Order (
  OrderId: AutoNumber NOT NULL UNIQUE,
  OrderDate: DateTime NOT NULL
)
INDEX (OrderDate DESC);
/

Simple commands such as HELP, EXIT, STATUS, SHOW, and DESCRIBE do not require a terminator.

Case Insensitivity

All MDL keywords are case-insensitive. The following are equivalent:

CREATE PERSISTENT ENTITY Sales.Customer ( ... );
create persistent entity Sales.Customer ( ... );
Create Persistent Entity Sales.Customer ( ... );

Identifiers (module names, entity names, attribute names) are case-sensitive and must match the Mendix model exactly.

Statement Categories

MDL statements fall into several categories:

CategoryExamples
QuerySHOW ENTITIES, DESCRIBE ENTITY, SEARCH
Domain ModelCREATE ENTITY, CREATE ASSOCIATION, ALTER ENTITY
EnumerationsCREATE ENUMERATION, ALTER ENUMERATION
MicroflowsCREATE MICROFLOW, DROP MICROFLOW
PagesCREATE PAGE, ALTER PAGE, CREATE SNIPPET
SecurityGRANT, REVOKE, CREATE USER ROLE
NavigationCREATE OR REPLACE NAVIGATION
ConnectionCONNECT LOCAL, DISCONNECT, STATUS

Further Reading