Connect MS SQL Azure with Python (RaspberryPi)

0

I'm having difficulty connecting to SQL in Raspberry Pi, using Python.

I made this class:

import pyodbc

class MaximoNivel(object):

    def __init__(self, Ponto):
        self.Ponto = Ponto

    def Retorna(self):
        server = 'tcp:server.database.windows.net'
        database = 'TesteDataBase'
        username = 'Administrador'
        password = '************'
        driver= '{ODBC Driver 13 for SQL Server}'
        cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';PORT=1443;DATABASE='+database+';UID='+username+';PWD='+ password)
        cursor = cnxn.cursor()
        SQL  = "Select MaxColunaDagua from NivelMaximo where Ponto=1"
        cursor.execute(SQL)
        row = cursor.fetchone()
        while row:
            return row[0]
            row = cursor.fetchone()

Running these classes on my Windows PC ran perfectly. In Raspberry I have difficulties in installing {ODBC Driver 13 for SQL Server}, tried version 17 and others and could not succeed, following these guidelines:

link

link python

Any tips? NOTE: Of course I can not switch to MySQL.

    
asked by anonymous 15.05.2018 / 18:59

0 answers