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

Load jinjia SQL templates from file system #670

Open
4 tasks
kdhrubo opened this issue Aug 19, 2024 · 5 comments
Open
4 tasks

Load jinjia SQL templates from file system #670

kdhrubo opened this issue Aug 19, 2024 · 5 comments
Assignees
Labels
enhancement New feature or request templates issues involving templatized SQL from files work in progress Issue that is being currently worked on

Comments

@kdhrubo
Copy link
Collaborator

kdhrubo commented Aug 19, 2024

For templatized SQL all templates should be created with Jinjia.

Jinjia for Java - https://github.com/HubSpot/jinjava

Acceptance
Tasks:

  • Must be able to read from the file system for jar-based deployments.
  • Must be able to load from docker volumes.
  • Only one folder with multiple SQL files(jinjia format) to be supported.
  • Update documentation on website Document custom query db2rest-web#7
@kdhrubo kdhrubo added the enhancement New feature or request label Aug 19, 2024
@kdhrubo kdhrubo added this to the Aug2024 milestone Aug 19, 2024
@kdhrubo
Copy link
Collaborator Author

kdhrubo commented Aug 19, 2024

Example SQL File

SELECT * FROM public.users
WHERE age >= {{ context.params.age }};

The first one uses request parameters.

SELECT * FROM public.users
WHERE id = {{ context.paths.id }};

The second one uses path variables.

SELECT * FROM public.users
WHERE id = {{ context.headers.id }};

The third one uses http header variables.

@ntananh ntananh added the work in progress Issue that is being currently worked on label Aug 25, 2024
@thadguidry
Copy link
Collaborator

thadguidry commented Aug 27, 2024

I think Pebble might be better option as discussed in Discord thread? dunno.

@kdhrubo
Copy link
Collaborator Author

kdhrubo commented Aug 27, 2024

Will check.

@ntananh
Copy link
Collaborator

ntananh commented Sep 8, 2024

Just for confirm, the API end-point for this feature is: api/v1/sql/<filename>

@kdhrubo
Copy link
Collaborator Author

kdhrubo commented Sep 8, 2024 via email

@thadguidry thadguidry added the templates issues involving templatized SQL from files label Sep 8, 2024
@kdhrubo kdhrubo linked a pull request Sep 27, 2024 that will close this issue
kdhrubo pushed a commit that referenced this issue Sep 27, 2024
@kdhrubo kdhrubo removed this from the Aug2024 milestone Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request templates issues involving templatized SQL from files work in progress Issue that is being currently worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants