Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: use Jinja to manage SQLs in tests #7006

Closed
Tracked by #7577
lmatz opened this issue Dec 21, 2022 · 3 comments
Closed
Tracked by #7577

Discussion: use Jinja to manage SQLs in tests #7006

lmatz opened this issue Dec 21, 2022 · 3 comments
Assignees

Comments

@lmatz
Copy link
Contributor

lmatz commented Dec 21, 2022

Jinja is a template engine for Python and is also used by dbt to manage the codebase of SQLs.

Since we have both batch and streaming to test, in theory, the tests used for batch should also be used for streaming with proper modification. We don't want to write almost the same code(SQL) twice.

Also, for certain queries, batch and streaming modify differently in terms of the where condition, so that they can output something other than empty.

So we write some additional Jinja in SQL files as template files, and then generate the real SQLs to be tested when we want to test them.

Not necessarily Jinja, and also looking for tools other than Jinja to achieve the same goal.

@github-actions github-actions bot added this to the release-0.1.16 milestone Dec 21, 2022
@sumittal
Copy link
Contributor

This is a good tool for templating in such a scenario. +1 for this idea.

@liurenjie1024
Copy link
Contributor

Another use case is to avoid abuse of include in slt file. For example, if we can support template, we no longer need to include all slt.part files in another file, which prohibits parallel execution of slt files.

@tabVersion
Copy link
Contributor

block by #7577

@lmatz lmatz removed this from the release-0.1.17 milestone Feb 6, 2023
@xxchan xxchan closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
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

No branches or pull requests

6 participants