bug fix: sql writer
This commit is contained in:
parent
504596f838
commit
99d29f0a1f
|
@ -44,6 +44,14 @@ class SQLRW :
|
||||||
# We need to load the drivers here to see what we are dealing with ...
|
# We need to load the drivers here to see what we are dealing with ...
|
||||||
_handler = SQLWriter.DRIVERS[_args['provider']]
|
_handler = SQLWriter.DRIVERS[_args['provider']]
|
||||||
self.conn = _handler.connect(**_info)
|
self.conn = _handler.connect(**_info)
|
||||||
|
|
||||||
|
def isready(self):
|
||||||
|
_sql = "SELECT * FROM :table LIMIT 1".replace(":table",self.table)
|
||||||
|
try:
|
||||||
|
return pd.read_sql(_sql,self.conn).columns.tolist()
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
return False
|
||||||
def apply(self,_sql):
|
def apply(self,_sql):
|
||||||
"""
|
"""
|
||||||
This function applies a command and/or a query against the current relational data-store
|
This function applies a command and/or a query against the current relational data-store
|
||||||
|
@ -138,8 +146,8 @@ class SQLWriter(SQLRW,Writer):
|
||||||
finally:
|
finally:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
_args = {"db":"sample","table":"foo","provider":"postgresql"}
|
# _args = {"db":"sample","table":"foo","provider":"postgresql"}
|
||||||
# # w = SQLWriter(**_args)
|
# # # w = SQLWriter(**_args)
|
||||||
# # w.write({"name":"kalara.io","email":"ceo@kalara.io","age":10})
|
# # # w.write({"name":"kalara.io","email":"ceo@kalara.io","age":10})
|
||||||
r = SQLReader(**_args)
|
# r = SQLReader(**_args)
|
||||||
print (r.read(filter='age > 0',limit = 20))
|
# print (r.read(filter='age > 0',limit = 20))
|
Loading…
Reference in New Issue