This is an automated email from the ASF dual-hosted git repository.
sfirke pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new b9ac800bfb docs(templating): Replace "true" with "1 = 1" and explain
its purpose (#30743)
b9ac800bfb is described below
commit b9ac800bfb087ee5c08bbfa41e9362d0cadf3f87
Author: Sam Firke <[email protected]>
AuthorDate: Tue Oct 29 13:00:46 2024 -0400
docs(templating): Replace "true" with "1 = 1" and explain its purpose
(#30743)
---
docs/docs/configuration/sql-templating.mdx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/docs/docs/configuration/sql-templating.mdx
b/docs/docs/configuration/sql-templating.mdx
index 64caea2157..39bea00d85 100644
--- a/docs/docs/configuration/sql-templating.mdx
+++ b/docs/docs/configuration/sql-templating.mdx
@@ -48,12 +48,15 @@ WHERE (
{% if to_dttm is not none %}
dttm_col < '{{ to_dttm }}' AND
{% endif %}
- true
+ 1 = 1
)
```
-Note how the Jinja parameters are called within double brackets in the query,
and without in the
-logic blocks.
+The `1 = 1` at the end ensures a value is present for the `WHERE` clause even
when
+the time filter is not set. For many database engines, this could be replaced
with `true`.
+
+Note that the Jinja parameters are called within _double_ brackets in the
query and with
+_single_ brackets in the logic blocks.
To add custom functionality to the Jinja context, you need to overload the
default Jinja
context in your environment by defining the `JINJA_CONTEXT_ADDONS` in your
superset configuration