-
Notifications
You must be signed in to change notification settings - Fork 90
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
complete source code generation #19
Comments
I am not sure if there is a specific feature request described here, and the link to moban doesn't really provide any insight. Do you mind providing some additional details for us to consider? |
Sorry, the link should have been to @moremoban Unfortunately a long time has passed since I created this issue, and the exact use-case I had has now escaped my brain. The main part of it that I remember was I was trying to process a python file which contained several queries in it. I didnt want to run jinjaSQL at runtime - I wanted instead to run it at build time, to convert a template into a database specific python file. Processing a template with multiple queries was the key problem - especially the variable binding was problematic, perhaps because it was using |
I think I understand the idea here: applying the templates in a build step and generating rendered Frozen-Flask is an instructive example though in that I think this usecase would probably be best as a separate tool that uses JinjaSQL, as opposed to being built into JinjaSQL itself. This article illustrates some of the steps that could get you there, specifically the section entitled "From a template to the final SQL query." |
Well the key is that the input files, .sqljj2 ? ;-), would contain multiple queries, or DDL/DML. Using |
I would like to use this with https://github.com/moban to convert a template containing a few custom queries with preset data into a db-specific rendered file, each enclosed in a method which receives extra params and returns the cursor and bound output cols where possible.
A little more voodoo is needed for this tool to process a string containing multiple queries, such as expanding the params in generated wrapping code. That could be done manually in jinja, but it would be a shame to do it that way as this tool is so close.
Moban allows plugins, so some extra init and per file steps can be done in the plugin to make this workable, but ideally most of the voodoo is in this project so it is reusable.
The text was updated successfully, but these errors were encountered: