Cannot accessing SQL Server in Python using pyodbc

Below is the code I am using while working on a Python flask website to access SQL Server. It is with accessing Database section I am unable to use the connection string , can I get some help on that please.

from flask import Flask, render_template, request
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.engine import URL
import urllib
from flask import app
import pyodbc

app = Flask(__name__)

db_env = 'dev'
if db_env == 'dev':
   app.debug = True

connection_string = "DRIVER={SQL Server Native Client 17.0};SERVER=localhost;DATABASE=PlatformDatabase;UID=sa;PWD=999999"
connection_url = URL.create("mssql+pyodbc", query={"odbc_connect": connection_string})
app.debug = False
app.config['SQLALCHEMY_DATABASE_URI'] = ''

db = SQLAlchemy(app) #Database Object

class knowshare(db.Model):
__database__  = 'PlatformDatabase'
__tablename__ = 'knowshare'
id = db.Column(db.Integer, primary_key=True)
customer = db.Column(db.String(200), unique=True)
dealer = db.Column(db.String(200))
rating = db.Column(db.Integer)
comments = db.Column(db.Text())

def __init__(self, customer, dealer, rating, comments):
    self.customer = customer   = dealer
    self.rating   = rating
    self.comments = comments

I am not sure what that means. If you mean that the connection string is incorrect (or you think it is) then can you connect to the database using SQL Server Management Studio (SSMS)? If you can then you can view the connection string properties there.