How to load remote database in cache, in python?
<p>I want to load a database from a remote server to my memory/cache, so that I don't have to make network calls every time I want to use the database. </p>

<p>I am doing this in Python and the database is <code>cassandra</code>. How should I do it? I have heard about <code>memcached</code> and <code>beaker</code>. Which library is best for this purpose?</p>

<p>If you are trying to get some data from a database, use the <a href="https://mkleehammer.github.io/pyodbc/" rel="nofollow">pyodbc</a> module. This module can be used to download data from a given table in a database. Answers can also be found in <a href="http://stackoverflow.com/questions/11451101/retrieving-data-from-sql-using-pyodbc">here</a>.</p>

<p>An example how to connect:</p>

<pre><code>import pyodbc
cnxn = pyodbc.connect('DRIVER={SQLServer};SERVER=SQLSRV01;
                       DATABASE=DATABASE;UID=USER;PWD=PASSWORD')
cursor = cnxn.cursor()

cursor.execute("SQL_QUERY")
for row in cursor.fetchall():
    print row
</code></pre>

python database caching cassandra memcached