Can we run sql queries on function module/in code section

Can we run sql queries in our function(code) module, client is using azure server for data base and asked whether if we can integrate and run sql queries in yellow platform code. We understand we can use api for this but wanted to know the feasibility.

sample code is pasted below.

var mysql = require(‘mysql’);

var con = mysql.createConnection({
host: “localhost”,
user: “yourusername”,
password: “yourpassword”
});

con.connect(function(err) {
if (err) throw err;
console.log(“Connected!”);
con.query(“CREATE DATABASE mydb”, function (err, result) {
if (err) throw err;
console.log(“Database created”);
});
});