Skip to main content

Convert compiled Microsoft Dynamics 365 Business Central AL packages (.app) into DBML schemas.

Project description

al2dbml

al2dbml is a small Python CLI that converts a compiled Microsoft Dynamics 365 Business Central AL package (.app) into a DBML schema you can paste straight into dbdiagram.io or dbdocs.io. The pipeline reads SymbolReference.json from the .app archive (tolerating AL's 40-byte header), normalises tables, extensions, enums, and TableRelations, and emits one valid DBML document with Table, Ref, Enum, and TableGroup sections.

Install

pip install -e ".[dev]"

Python 3.10+ is required. The runtime depends only on click and pydbml.

Quickstart

al2dbml MyApp.app -o schema.dbml

Drop schema.dbml into https://dbdiagram.io. Without -o, the DBML is streamed to stdout so you can pipe it elsewhere.

al2dbml MyApp.app | less

Grouping

By default tables are bucketed into TableGroups by their first whitespace-separated word, dropping any bucket smaller than two tables (so Sales Header + Sales Line become group Sales, while a lone Customer stays ungrouped).

# Auto grouping (default)
al2dbml MyApp.app -o schema.dbml

# Explicit rules; the value is NAME=PATTERN[,PATTERN...] and -g is repeatable
al2dbml MyApp.app -g "Documents=Sales*,Purch*" -g "Master=Customer,Vendor,Item"

# Disable grouping entirely
al2dbml MyApp.app --no-groups

# Keep singleton groups too
al2dbml MyApp.app --min-group-size 1

--no-auto-groups switches off the first-word fallback so only your explicit -g rules apply.

TableExtensions

Extensions are merged into their target tables by default. Use --no-merge-extensions to emit them as separate <Target> (Extension) tables instead.

Public Python API

from al2dbml import Generator, generate, GroupingConfig

# One-shot helper
dbml = generate("MyApp.app", output_path="schema.dbml")

# Or step-by-step for custom grouping
gen = Generator.from_app(
    "MyApp.app",
    grouping=GroupingConfig(rules={"Documents": ["Sales*", "Purch*"]}),
)
print(gen.dbml())

Limitations (0.1.0)

  • FlowFields are treated as regular fields — the underlying CalcFormula is not interpreted.
  • Obsolete fields are emitted alongside active ones; no filtering by ObsoleteState.
  • Multi-field primary keys are represented as multiple [pk] flags rather than a composite index, matching DBML's single-PK convention.
  • Cross-package references (table relations that point to a table outside the current .app) are preserved as notes on the source column, since the target table is not present in the diagram.
  • Complex IF (...) ... ELSE ... conditional TableRelation expressions fall back to a note rather than a fully-modeled reference.

Development

python -m venv .venv
.venv/bin/pip install -e ".[dev]"
.venv/bin/pytest -q
.venv/bin/ruff check .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

al2dbml-0.1.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

al2dbml-0.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file al2dbml-0.1.0.tar.gz.

File metadata

  • Download URL: al2dbml-0.1.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for al2dbml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fe16f41186476aa9e4a23e1a930ce0a0b764ad44ca8f47134e0e60b78c645e36
MD5 9f51f1f174c4948d2674a8e91ed1eefd
BLAKE2b-256 7d76fc453361238a79e540929646537d87a24527fe0bfd0ecf8207ddd17fe182

See more details on using hashes here.

Provenance

The following attestation bundles were made for al2dbml-0.1.0.tar.gz:

Publisher: publish.yml on mykola-kharchenko/al2dbml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file al2dbml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: al2dbml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for al2dbml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9cc3fd50bdab38136d79d01d3855a8dd22e5382a396e3f38a23a0bd9d889cca
MD5 e87c91506dd25b9313c8aa576451a0da
BLAKE2b-256 c0f180332f55cea8c0b58bcd2eed7ec0b17623ae7563ce97806c4654284c2a62

See more details on using hashes here.

Provenance

The following attestation bundles were made for al2dbml-0.1.0-py3-none-any.whl:

Publisher: publish.yml on mykola-kharchenko/al2dbml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page