|
|
@ -106,7 +106,7 @@ class DiskWriter(Writer):
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
|
DiskWriter.THREAD_LOCK.release()
|
|
|
|
DiskWriter.THREAD_LOCK.release()
|
|
|
|
class SQLiteReader (DiskReader):
|
|
|
|
class SQLiteReader (DiskReader):
|
|
|
|
def __init__(self,**args)
|
|
|
|
def __init__(self,**args):
|
|
|
|
DiskReader.__init__(self,**args)
|
|
|
|
DiskReader.__init__(self,**args)
|
|
|
|
self.conn = sqlite3.connect(self.path,isolation_level=None)
|
|
|
|
self.conn = sqlite3.connect(self.path,isolation_level=None)
|
|
|
|
self.conn.row_factory = sqlite3.Row
|
|
|
|
self.conn.row_factory = sqlite3.Row
|
|
|
@ -114,10 +114,10 @@ class SQLiteReader (DiskReader):
|
|
|
|
def read(self,**args):
|
|
|
|
def read(self,**args):
|
|
|
|
if 'sql' in args :
|
|
|
|
if 'sql' in args :
|
|
|
|
sql = args['sql']
|
|
|
|
sql = args['sql']
|
|
|
|
else if 'filter' in args :
|
|
|
|
elif 'filter' in args :
|
|
|
|
sql = "SELECT :fields FROM ",self.table, "WHERE (:filter)".replace(":filter",args['filter'])
|
|
|
|
sql = "SELECT :fields FROM ",self.table, "WHERE (:filter)".replace(":filter",args['filter'])
|
|
|
|
sql = sql.replace(":fields",args['fields']) if 'fields' in args else sql.replace(":fields","*")
|
|
|
|
sql = sql.replace(":fields",args['fields']) if 'fields' in args else sql.replace(":fields","*")
|
|
|
|
return = pd.read_sql(sql,self.conn)
|
|
|
|
return pd.read_sql(sql,self.conn)
|
|
|
|
def close(self):
|
|
|
|
def close(self):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.conn.close()
|
|
|
|
self.conn.close()
|
|
|
|