Connecting to a SQL db using python
<p>I currently have a python script that can connect to a mySQL db and execute queries.  I wish to modify it so that I can connect to a different SQL db to run a separate query.  I am having trouble doing this, running osx 10.11.  This is my first question and I'm a newbie programmer so please take it easy on me...</p>

<p>Here is the program i used to for mySQL</p>

<pre><code>sf_username = "user"
sf_password = "pass"
sf_api_token = "token"

sf_update = beatbox.PythonClient()
 password = str("%s%s" % (sf_password, sf_api_token))
sf_update.login(sf_username, password)

t = Terminal()

hub = [stuff]

def FINAL_RUN():
    cnx = alternate_modify(hub)
    cur = cnx.cursor()
    queryinput = """
    SQL QUERY I WANT
    """
    cur.execute(queryinput)
    rez = cur.fetchone()
    while rez is not None:
        write_to_sf(rez)
        rez = cur.fetchone()

FINAL_RUN()
</code></pre>

<p>I was able to get connected using SQL Alchemy--thank you.  If anyone else tries, I think you'll need a ODBC driver per this page: </p>

<p><a href="http://docs.sqlalchemy.org/en/latest/dialects/mssql.html" rel="nofollow">http://docs.sqlalchemy.org/en/latest/dialects/mssql.html</a></p>

<p>Alternatively, pymssql is a nice tool.  If you run into trouble installing like I did, there is a neat workaround here:</p>

<p><a href="http://stackoverflow.com/questions/37771434/mac-pip-install-pymssql-error">mac - pip install pymssql error</a></p>

<p>Thanks again</p>

python mysql sql database