Giter VIP home page Giter VIP logo

Comments (4)

sripathikrishnan avatar sripathikrishnan commented on August 29, 2024

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?

from jinjasql.

jayvdb avatar jayvdb commented on August 29, 2024

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 %s instead of {name} ... ?

from jinjasql.

clayadavis avatar clayadavis commented on August 29, 2024

I think I understand the idea here: applying the templates in a build step and generating rendered .sql queries, similar to Frozen-Flask generating static HTML from templates + data.

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."

from jinjasql.

jayvdb avatar jayvdb commented on August 29, 2024

.. rendered .sql queries ..

Well the key is that the input files, .sqljj2 ? ;-), would contain multiple queries, or DDL/DML. Using pyformat, like you did in apply_sql_template, probably makes this easier.

from jinjasql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.