0

I have raspberry pi 3 that gets me data from sensors by using Python. I want to send that data to a windows pc and precisely to the SQL server. I knew that the best choice I have is to use the httprequest method or get/post. Any help concerning the code of the service?

MHD BKT
  • 19
  • 2

1 Answers1

0

You can use direct queries from your python application gathering data to send it to your SQL Server - it doesn't matter if the SQL Server is running on Widows or Linux. If you want to send it via HTTP Request, you will need to write second application - API to process the request and save data to SQL Server. In that case see the link below.

Connecting python 3.3 to microsoft sql server 2008

Connecting to Microsoft SQL server using Python

GitHub of pyodbc library

import pyodbc 
db = pyodbc.connect("Driver={SQL Server Native Client 13.0};"
                  "Server=server_name;"
                  "Database=db_name;"
                  "Trusted_Connection=yes;"
                  "uid=username;"
                  "pwd=password";)
cursor = db.cursor()
cursor.execute('some SQL query')                                                            
alinous
  • 61
  • 4