|
|
|
@ -15,6 +15,7 @@ class Base:
|
|
|
|
|
self._database = _args['database']
|
|
|
|
|
self._table = _args['table'] if 'table' in _args else None
|
|
|
|
|
self._engine= sqa.create_engine(self._get_uri(**_args),future=True)
|
|
|
|
|
self._chunksize = 0 if 'chunksize' not in _args else _args['chunksize']
|
|
|
|
|
def _set_uri(self,**_args) :
|
|
|
|
|
"""
|
|
|
|
|
:provider provider
|
|
|
|
@ -60,8 +61,10 @@ class Base:
|
|
|
|
|
@TODO: Execution of stored procedures
|
|
|
|
|
"""
|
|
|
|
|
if sql.lower().startswith('select') or sql.lower().startswith('with') :
|
|
|
|
|
|
|
|
|
|
return pd.read_sql(sql,self._engine)
|
|
|
|
|
if self._chunksize :
|
|
|
|
|
return pd.read_sql(sql,self._engine,chunksize=self._chunksize)
|
|
|
|
|
else:
|
|
|
|
|
return pd.read_sql(sql,self._engine)
|
|
|
|
|
else:
|
|
|
|
|
_handler = self._engine.connect()
|
|
|
|
|
_handler.execute(text(sql))
|
|
|
|
|