connection = pypyodbc.connect('Driver={ODBC Driver 13 for SQL Server};'
'uid=[your_hivesql_account];'
'pwd=[your_hivesql_password]')
cursor = connection.cursor()
SQLCommand = ("YOUR SQL QUERY”)
cursor.execute(SQLCommand)
# do whatever you want with the retrieved data