Using Mysqldb rather than sqlalchemy

import MySQLdb
import sys
import time
    conn = MySQLdb.connect (host = "spider.db", user = "root", passwd = "", db = "spider")
except MySQLdb.Error, e:
    print "Error %d: %s" % (e.args[0], e.args[1])
    sys.exit (1)
print (time.time()-times), ": Connect to MySql"
db = conn.cursor ()
q = "SELECT DISTINCT url_queue.rdomain FROM url_queue WHERE url_queue.is_disabled =0"
print (time.time()-times), ": Initializing MySQL Query"
print (time.time()-times), ": The query has executed successfully. \n Now, fetching data to rdomain" 
print (time.time()-times), ": Data has been fetched and saved to rdomains! :)"


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: