Rest API to read and write data to Azure SQL DB - python

There is a AI based Web Application which needs to be connected to Azure SQL DB.
So I have to create a Rest API as an interface to connect the web app GUI to the Azure SQL DB.
Please suggest how can I achieve this. I searched other posts which suggest that we can expose the Azure SQL DB via ODATA service but not sure where to start from.
I followed the post
How to expose Azure Sql Server database using OData
Need some help from where to start.

I found this guide for you.
Even if it's not for Python you get the point, this is how to work with Azure SQL Database and create a GUI interface.

Related

How to safely fetch data from an sql database in a python desktop application?

I'm looking for something like REST API which I've used for web applications using Django. How do I achieve similar functionality for a desktop application using REST or some other API where I don't have to type out SQL in plain text in the source files?
The use case is for user authentication and fetching certain messages from the SQL database.

Exposing Snowflake Table Data as a REST API

I need to expose snowflake table data as an API.
But snowflake doesn't provide REST API to achieve this.
How do I achieve this?
You will need to implement something yourself. A common approach an application that RESTfully listens for queries over HTTP, uses the Snowflake JDBC driver to retrieve the data, then encodes it into JSON and responds. Here is a generic example: https://github.com/hellofiremind/jdbc-sql-rest
As mentioned in the previous answer, you will have to connect snowflake using ODBC and implement APIs using a web framework.
There is also a new project Dozer that can instantly publish Snowflake as APIs.
https://github.com/getdozer/dozer
Disclaimer: I am one of the main contributors of Dozer.

Azure VM: How to send Start/Stopped/Restart Events to Webapp

I have a Webapp that writes the status of Azure VMs in a DB. I want to be able to have the DB update automatically every time a VM is started/stopped/restarted. How do I set up a trigger that POST to my Webapp when the VM is started/stopped/restarted? I'm using the Azure Python SDK. Thank you.
You don't need to write code to achieve this you could use EventGrids in Azure linked to a logic app which would write straight into your database. Here is an example of how to set up an EventGrid to send emails when linked to a logic app. This is an example in how to connect a Logic App to a database. The combination of these two examples will allow you to use Azure native technologies to achieve your goal.
Alternatively instead of writing straight to the database you could use the logic app to POST to your website using one of the connectors.
Hope that helps.

Possibility of connecting MySQL database to Google Assistant

What I want to implement is at least a working prototype of a Google Assistant Action with the use of local MySQL database. What I've taught of is MySQL DB-> Google Cloud Platform-> DialogFlow -> Google Assistant.
So the end product would be for example, I say: "What is my total sales" and Google Assistant would retrieve the data from MySQL. I've been trying to look for solutions online and none seem to match what I am looking for. Would this solution be theoretically possible? and how would I be able to integrate the cloud platform into the Google Assistant Action through DialogFlow? Thanks!
It is possible!
Create a Dialogflow agent. Define your intents and add the static response. Test it.
Once tests are passed, integrated it with Actions-On-Google using "Integration tab" to the left.
Test the Assistant with static responses.
When Assistant is ready with the static response, develop a webhook. You can use different client libraries in NodeJS (AoG Client or Dialogflow Client) or in Python (Flask-Assistant or Dialogflow Client) or can create your own.
Once the webhook is ready, run it locally and expose to the internet using NGROK.
Use the generated URL as fulfillment to the Dialogflow agent and update the assistant's draft version.
Create a MySQL DB and connect it webhook using regular NodeJS or Python code
Restart the server and test end to end!
Once tested locally with NGROK, you can PUSH it to the cloud (NodeJS or Python) or any other server.

python mysql insert the received message from android

How to insert the received message from android to python in mySQL?
In other words I'm opening socket between android and python and anything I enter in android it send to my python then I want this thing whatever string or it to be insert to python !!
I know about the insert method and it works fine with me but I want to do this method using the received message. Any help?
What you might want to consider is setting up a Python-based Web service. Call the Web service from Android and have the Web service do your database INSERTs for you.
Be sure to implement sufficient measures in your Web service to ensure that not-just-any query is allowed to be performed simply by passing it into your Web service. Implement a query sanitizer, or similar. SQLAlchemy is a fairly heavy-weight ORM framework (implemented in Python), but it does have its own query sanitizer.

Categories