Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExasolHook get_pandas_df does not return pandas dataframe but None #17850

Merged
merged 6 commits into from
Aug 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions airflow/providers/exasol/hooks/exasol.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from contextlib import closing
from typing import Any, Dict, List, Optional, Tuple, Union

import pandas as pd
import pyexasol
from pyexasol import ExaConnection

Expand Down Expand Up @@ -63,7 +64,9 @@ def get_conn(self) -> ExaConnection:
conn = pyexasol.connect(**conn_args)
return conn

def get_pandas_df(self, sql: Union[str, list], parameters: Optional[dict] = None, **kwargs) -> None:
def get_pandas_df(
self, sql: Union[str, list], parameters: Optional[dict] = None, **kwargs
) -> pd.DataFrame:
"""
Executes the sql and returns a pandas dataframe

Expand All @@ -76,7 +79,8 @@ def get_pandas_df(self, sql: Union[str, list], parameters: Optional[dict] = None
:type kwargs: dict
"""
with closing(self.get_conn()) as conn:
conn.export_to_pandas(sql, query_params=parameters, **kwargs)
df = conn.export_to_pandas(sql, query_params=parameters, **kwargs)
return df

def get_records(
self, sql: Union[str, list], parameters: Optional[dict] = None
Expand Down