How can I let DataGrip replace parameters in single quotes?

I want to use parameters in single quotes for my query:

    SELECT * FROM my_table WHERE data_date = '{{ current_date }}'

However, DataGrip will not replace a parameter if it is in single quotes. If there a configuration I could change or can I write the match pattern in a certain way to bypass this limitation? 

I really want this to work because I want to reuse the SQL file in DataGrip and my Python program and Jinja template.

Currently my solution is to add a custom macro to wrap string in quotes in Jinja, and adjust the match pattern accordingly:

    SELECT * FROM my_table WHERE data_date = {{ q(current_date) }}

which is not ideal. Would really appreciate it if someone could suggest a cleaner way or DataGrip could fix this.

4

Please sign in to leave a comment.