Fix: bring back support for MySQL

This commit is contained in:
Arik Fraimovich 2014-02-05 12:10:13 +02:00
parent 2942d20ac3
commit 250aa17e63
4 changed files with 7 additions and 8 deletions

View File

@ -20,7 +20,7 @@ def start_workers():
logging.info("Cleaning old workers: %s", old_workers)
data_manager.start_workers(settings.WORKERS_COUNT, settings.CONNECTION_STRING)
data_manager.start_workers(settings.WORKERS_COUNT, settings.CONNECTION_ADAPTER, settings.CONNECTION_STRING)
logging.info("Workers started.")
while True:

View File

@ -149,15 +149,15 @@ class Manager(object):
return data
def start_workers(self, workers_count, connection_string):
def start_workers(self, workers_count, connection_type, connection_string):
if self.workers:
return self.workers
if getattr(settings, 'CONNECTION_ADAPTER', None) == "mysql":
import query_runner_mysql
from redash.data import query_runner_mysql
runner = query_runner_mysql.mysql(connection_string)
else:
import query_runner
from redash.data import query_runner
runner = query_runner.redshift(connection_string)
redis_connection_params = self.redis_connection.connection_pool.connection_kwargs

View File

@ -10,8 +10,7 @@ import logging
import json
import MySQLdb
import sys
import select
from .utils import JSONEncoder
from redash.utils import JSONEncoder
def mysql(connection_string):
if connection_string.endswith(';'):

View File

@ -4,7 +4,7 @@ Example settings module. You should make your own copy as settings.py and enter
REDIS_URL = "redis://localhost:6379"
# Either "pg" or "mysql"
CONNECTION_ADAPTER = "mysql"
CONNECTION_ADAPTER = "pg"
# Connection string for the database that is used to run queries against
# -- example mysql CONNECTION_STRING = "Server=;User=;Pwd=;Database="
# -- example pg CONNECTION_STRING = "user= password= host= port=5439 dbname="