Tool to create text files from DBML using Jinja2 templates.
Project description
Dinja
Dinja is a small tool for creating any text file format from a DBML database definition using Jinja2 templates. It can be used to auto-generate e.g. database access code or schema documentation from a single database schema definition.
Its name is made from "DBML" and "Jinja2", but it's also name of Cucumis melo (a melon) 🍈 🍉 in Croatian.
Installation
Dinja is available on PyPI, so you can install it with pip:
pip install dinja
Usage
1. Create your Jinja2 template(s)
The template files are of the destination file format but contain some special markers that Dinja
replaces with the real database schema data. Their file names must end with either .jinja or
.in. See the Jinja2 template documentation
for how to write such a template.
The Python data structures provided to the templates are documented in the dinja.api module.
Dinja can render several template files at once - simply put them all into a single directory.
2. Run Dinja on your DBML file
The following command converts the dbschema.dbml file by rendering all template files inside the
jinja_templates directory, storing the resulting files into the generated directory
rendered file for each template).
$ dinja dbschema.dbml jinja_templates generated
The result files have the names as their corresponding template
files, but without the .jinja or .in suffix. Existing files are overwritten without a warning.
dinja -h or dinja --help prints a summary of all possible options and arguments.
Copyright & License
Copyright 2025 by Thomas Wesenigk.
Licensed under the EUPL 1.2. Visit https://interoperable-europe.ec.europa.eu/collection/eupl/eupl-text-eupl-12 to read it in your favourite language.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dinja_tool-0.1.0.tar.gz.
File metadata
- Download URL: dinja_tool-0.1.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.7 Linux/6.8.0-55-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ef52dd52075edc9213b30e5e63cb6f2c84ef09f599eb48eeefd0c391d681157
|
|
| MD5 |
6d14717d40d976286238011c24d8f8a8
|
|
| BLAKE2b-256 |
95c51b323343cd0d24ea5d5b8abe14dddd3d453956f79a27f7c38ac3ff8e4052
|
File details
Details for the file dinja_tool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dinja_tool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.12.7 Linux/6.8.0-55-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19aabef4176c87ed2a4b4b2e4d8cf49101e9b015308205edc02c1783624ddfe0
|
|
| MD5 |
5827839e65ee7cd916444c3562e320c5
|
|
| BLAKE2b-256 |
78d08814f42fab33bf16a8435fcbd28cae1605214d9bc3eef345ebf8f76c6172
|