Databases
Databases play a crucial role in numerous applications, serving as the backbone for storing and managing data. With DronaHQ, you have the capability to execute queries for data retrieval and modification directly from its intuitive editor.
Connecting a Database
Here you will learn how to connect to a database on DronaHQ.
- Click on
Connectors
from the sidebar. - You will see, on top right there is a
+ Connector
button, click on it. - From the list, select the database you need to connect to. This opens the page where you can configure the parameters to connect to your database.
Give a name to the configuring database, to identify it later on.
Fill up the required details and parameters to configure your database on DronaHQ successfully. DronaHQ encrypts all your data and store them securely.
Click the
Test
button and test the connection. Ensure that the database is valid.Click
Save
to create and save the database connection.
We offer AI-powered suggestions in the test connection phase for all database connectors.
This support is helpful when encountering errors during configuration and testing, aiding in understanding errors and presenting common troubleshooting causes for easier resolution.
Writing Queries
The information you want to present in any application is spread across multiple tables in a database. Queries play a vital role in collecting data from different tables and consolidating it for display.
With queries, you can perform various operations such as data insertion, updating, or removal from the database. Furthermore, queries enable data binding to widgets and offer additional functionalities that enhance the overall performance and user experience of the application.
This section talks about the steps to create a database query in the query editor:
- Once you are done with configuring database connector. It will show in the connectors' list. Click on the
Add Query
button.
- The query editor will open. You need to provide a name for the query and then write MySQL queries (Since here MySQL
database is taken as an example.) under
Write Your Query
.
database-dependent query editors enable users to write queries that are optimized for specific database systems, ensuring efficient and precise data manipulation. :::
effortlessly using natural language prompts. This exceptional functionality allows users to generate database queries with ease, making the process much faster and more user-friendly. :::
- Write a query, let's say to fetch all the details from a table in the database. After that, click
Test Quey
.
- Click
Save
and your query will be added to the database connector.
Making Queries Dynamic
In the realm of database connections, the key factor lies in the manner in which we execute queries.
In certain situations, such as when retrieving order details for products in a shop, there may be a need to obtain specific details for different products each time. To achieve this, dynamic inputs can be utilized. By incorporating dynamic parameters into the query, it becomes possible to fetch data from the data source based on the specific product details desired. This approach allows for flexibility and enables the retrieval of product details by passing dynamic parameters whenever required.
In DronaHQ's Query Builder, it is possible to accomplish this by creating variables using {{ }}
notation when adding a
query to a configured datasource connector, (It can be database or API connector). These variables can then be utilized
to pass dynamic parameters to queries through various methods, such as forms, data, user-input, and more, within the
App.
Let's see how to pass parameters to database query:
For Example, suppose we need to retrieve data from a table based on a particular order ID. However, we want this order ID to be dynamic and passed as a parameter to the query of the database connector.
As shown in the image above, the orderid
has been transformed into a dynamic variable. Consequently, you can
conveniently provide parameter values from the app by utilizing keywords.