Skip to content

initial jinja support#40

Merged
tobymao merged 2 commits intomainfrom
toby/jinja
Dec 13, 2022
Merged

initial jinja support#40
tobymao merged 2 commits intomainfrom
toby/jinja

Conversation

@tobymao
Copy link
Copy Markdown
Contributor

@tobymao tobymao commented Dec 10, 2022

No description provided.

@tobymao tobymao force-pushed the toby/jinja branch 2 times, most recently from ad20245 to 3362e9a Compare December 10, 2022 07:12
@georgesittas
Copy link
Copy Markdown
Collaborator

georgesittas commented Dec 12, 2022

Looks good at first glance. Let me know if there are any outstanding items I can help with.

@tobymao tobymao force-pushed the toby/jinja branch 2 times, most recently from 10bce56 to 616cd8c Compare December 13, 2022 03:14
ON oi.item_id = i.id AND oi.ds = i.ds
WHERE
oi.ds BETWEEN @start_ds AND @end_ds
oi.ds BETWEEN '{{ start_ds }}' AND '{{ end_ds }}'
Copy link
Copy Markdown
Collaborator

@izeigerman izeigerman Dec 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noooooooooooooooooooooo 🤮 😆

Comment thread tests/core/test_model.py Outdated
)

with pytest.raises(ConfigError) as ex:
with pytest.raises(ValidationError) as ex:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don' think we should let the jinja error out. We should intercept it and raise the ConfigError instead which would in turn contain a path to a model file where the error occurred.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the _raise_config_error usage in Model.load

Comment thread tests/core/test_model.py
Comment thread sqlmesh/core/dialect.py
Copy link
Copy Markdown
Collaborator

@izeigerman izeigerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few smaller comments, LGTM otherwise

Comment thread sqlmesh/core/model.py

def __init__(self, definition: str = "", **kwargs):
meta, *expressions = parse(definition, read=kwargs.get("dialect"))
meta, *expressions = d.parse_model(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I'm planning to refactor this decorator to use Model.load instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounsd good, let me get this in first

@tobymao tobymao merged commit df5dca0 into main Dec 13, 2022
@tobymao tobymao deleted the toby/jinja branch December 13, 2022 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants