Query Builder¶
Introduction¶
A Query builder is a tool or library that helps developers construct database queries in a more intuitive and structured way, often without requiring direct knowledge of the query language (like SQL).
It serves as an abstraction layer between the developer and the database.
Common use cases include: Database Administration Tools, Web Application, Report Generation etc.
How to use Query Builder?¶
-
Login to your account.
-
Navigate to IDE
+
sign Query Builder.
3.Select the App and enter the domain where the App will be visible and accessible.
4.Click Save
.
5.The created Query will be visible on the IDE panel under Query Builder tab.
6.Click on your created Query.
7.Enter the SQL query code.
8.Click on Save
and then Run
. It will display a query output.
9.You can Run
and Save
the code, Toggle Console
, Preview (errors)
, Request Cancellation
for cancelling any ongoing requests, for example taking longer to execute, Settings
you can edit, Set Vars, Copy file ID, Copy UUID using Settings.
G3 Query Builder¶
When creating a query, you can select the data source as G3, which is helpful when you intend to visualize the data as a graph.
The start_dat
e feature facilitates specifying time ranges using natural language parsing in JavaScript.
start_date
is a natural language date parser in Javascript. It can extract data from any provided text and handle the majority of date/time formats.
- Today, Tomorrow, Yesterday, Last Friday, etc
- 1 January 2013 - 9 May August 2013
- This Tuesday from 3:00 - 6.00
- 7 days ago
- 4 weeks from now
- Sun Aug 7 2013 18:40:39 UTC/GMT +5:30 hours (IST)
- 2024-11-30T08:15:30-05:30
Normal SQL Query | G3 Query |
---|---|
from cdr. cdrwhere dt>= DATE_SUB(NOW(), INTERVAL 30 DAY) |
start_date: 7 days ago |
You can also put a default value of the start_date
by making it a variable using Set Vars.
For example,
start_date: 7 days ago // G3 query
start_date: :start_date // making it a variable using Set Vars
You can put any value in the Vars field, it will be treated as a default value when you use the above code.