Created
April 30, 2014 21:48
-
-
Save rogaha/8788a5f852cf04265bbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
connection = mdb.connect(db_host, db_user, db_password, db_name, port=db_port) | |
cursor = connection.cursor(mdb.cursors.SSDictCursor) | |
cursor.execute("select user_agent from {0} where {1} LIKE " | |
"'%{2}%'".format(table_name, filter_field, filter_value)) | |
row = cursor.fetchone() | |
# Fetch each row at a time instead of fetching everything at once | |
# It improves the memory usage on the client side | |
while row is not None: | |
results.append(row) | |
row = cursor.fetchone() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment