Skip to content

nilswende/dbml-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

cda435b · Nov 5, 2024

History

39 Commits
Oct 25, 2024
Nov 5, 2024
Aug 27, 2023
Aug 26, 2023
Oct 29, 2024
Oct 29, 2024

Repository files navigation

DBML Parser for the JVM

Database Markup Language (DBML), designed to define and document database structures. See the original repository.

Using Java 17.

Example usage:

import com.wn.dbml.compiler.DbmlParser;
import com.wn.dbml.model.Database;

class Example {
  public static void main(String[] args) {
    var dbml = """
        Table table1 {
          id integer
        }""";
    // parse the dbml
    Database database = DbmlParser.parse(dbml);
    // process the database structure
    database.getSchemas().stream()
        .flatMap(schema -> schema.getTables().stream())
        .forEach(System.out::println); // prints "table1"
  }
}

For a more elaborate example see the DBML-to-Avro-Translator.

Maven dependency:

<dependency>
    <groupId>io.github.nilswende</groupId>
    <artifactId>dbml-java</artifactId>
    <version>1.2.0</version>
</dependency>