diff --git a/pub-sub-stream/receiver.py b/pub-sub-stream/receiver.py index 7059730..5c1edbb 100644 --- a/pub-sub-stream/receiver.py +++ b/pub-sub-stream/receiver.py @@ -1,12 +1,12 @@ import json +import time from queue import Queue from threading import Thread -import time -import mysql.connector +import MySQLdb from model.biography import Biography -from streamchannel.streams import polling_consumer, cancellation_token +from streamchannel.streams import cancellation_token, polling_consumer def map_from_message(message_body: str) -> Biography: @@ -15,8 +15,8 @@ def map_from_message(message_body: str) -> Biography: def handle_message(bio: Biography) -> bool: - mydb = mysql.connector.connect( - host="localhost", + mydb = MySQLdb.connect( + host="localhost", # try host="127.0.0.1" if failing to connect to MySQL running in Docker user="root", password="root", database="Lookup" diff --git a/pub-sub-stream/requirements.txt b/pub-sub-stream/requirements.txt index 9ba7d48..8b7c3e4 100644 --- a/pub-sub-stream/requirements.txt +++ b/pub-sub-stream/requirements.txt @@ -1,2 +1,2 @@ confluent-kafka==2.3.0 -mysqlclient==2.2.1 +mysqlclient==2.2.4