feat: streaming support on reads

v2.4
Steve Nyemba 1 month ago
parent a1cf78a889
commit 4e97b32530

@ -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,7 +61,9 @@ class Base:
@TODO: Execution of stored procedures
"""
if sql.lower().startswith('select') or sql.lower().startswith('with') :
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()

Loading…
Cancel
Save