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

Docs: Add SQL query example #17593

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ektravel
Copy link
Contributor

Add a SQL query example showing how to pass dynamic parameters.

Tested using CURL:

curl "http://localhost:8888/druid/v2/sql" \
--header 'Content-Type: application/json' \
--data '{
    "query": "SELECT \"arrayDouble\" FROM \"array_example\" WHERE ARRAY_CONTAINS(\"arrayDouble\", ?)",
    "parameters": [{"type": "ARRAY", "value": [999, null, 5.5]}] 
}'

Returns:

[{"arrayDouble":"[999.0,null,5.5]"}]

This PR has:

  • been self-reviewed.

docs/querying/sql.md Outdated Show resolved Hide resolved
docs/api-reference/sql-api.md Outdated Show resolved Hide resolved
@ektravel ektravel requested a review from vtlim December 20, 2024 21:55
}
]
{
"query": "SELECT \"arrayDouble\" FROM \"array_example\" WHERE ARRAY_CONTAINS(\"arrayDouble\", ?)",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to also update the query to use the string variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants