Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zhangyuan/zender
Compile templates written in Jinja, with metadata generated.
https://github.com/zhangyuan/zender
Last synced: 21 days ago
JSON representation
Compile templates written in Jinja, with metadata generated.
- Host: GitHub
- URL: https://github.com/zhangyuan/zender
- Owner: zhangyuan
- License: mit
- Created: 2023-11-04T09:32:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-10T03:17:13.000Z (about 1 year ago)
- Last Synced: 2024-10-27T14:35:25.858Z (2 months ago)
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zender
Render templates written in Jinja2, with extra metadata store.
## Installation
```bash
pip install zender
```## Usage
By default, `zender` renders the templates from `./templates` folder to `./target` folder.
Firstly, Create the `./templates` folder and add a templates, e.g. `./templates/active_users.sql`:
```sql
WITH source AS (
select id, username from {{ source('users') }} where status = 'active'
)
INSERT INTO {{ target('active_users') }}
SELECT id, username from source
```The compiled file is created in `./target/compiled/active_users.sql` with the following content:
```sql
WITH source AS (
select id, username from users where status = 'active'
)
INSERT INTO active_users
SELECT id, username from source
```And the metadata is saved into `target/metadata.json`:
```json
{
"lineage": [
{
"source_code": "active_users.sql",
"targets": [
"active_users"
],
"sources": [
"users"
]
}
]
}
```