|
@@ -34,9 +34,10 @@ class SQLHandlerPool(metaclass=SingletonThreadsafe):
|
|
|
self._log.warning("Ran out of SQL handlers, 10 more have been added. Are you sure you've returned yours?")
|
|
|
return self._sql_handlers.pop()
|
|
|
|
|
|
- def release(self, mongodb_handler):
|
|
|
+ def release(self, sql_handler):
|
|
|
if len(self._sql_handlers) < self._size:
|
|
|
- self._sql_handlers.append(mongodb_handler)
|
|
|
+ sql_handler._engine.dispose()
|
|
|
+ self._sql_handlers.append(sql_handler)
|
|
|
|
|
|
class SQLHandler:
|
|
|
'''
|
|
@@ -501,7 +502,6 @@ class SQLHandler:
|
|
|
:rtype: DataFrame
|
|
|
'''
|
|
|
try:
|
|
|
- '''
|
|
|
connection = self._engine.connect()
|
|
|
|
|
|
data = pd.read_sql(sql=query,
|
|
@@ -509,10 +509,7 @@ class SQLHandler:
|
|
|
**read_sql_kwargs)
|
|
|
|
|
|
connection.close()
|
|
|
- '''
|
|
|
- data = pd.read_sql(sql=query,
|
|
|
- con=self._engine,
|
|
|
- **read_sql_kwargs)
|
|
|
+
|
|
|
return data
|
|
|
|
|
|
except Exception as e:
|