Retrieve Data with SQL Database & Functions
See how to retrieve data from an existing database (DB) with SQL Database and Functions.
See how to retrieve data from an existing database (DB) with SQL Database and Functions.
go to SQL Database referenceRequirements
- Azion Functions enabled.
- An active Azion Personal Token.
Creating a database and adding a table
- Create a database by executing the following cURL:
- Add a table named
users:
- Populate the table with data:
Now, the DB is created and populated with rows.
Creating a function to communicate with SQL Database
- Access Azion Console.
- On the upper-left corner, select Functions in the Edge Libraries section.
- Click the + Function button.
- Choose a name for your function.
- Delete the placeholder function that is inside the code editor.
- Paste the following code:
This function was created to communicate with SQL Database. Now, it’s necessary to instantiate this function in a running application:
go to How to instantiate functions in your application