Skip to content

Commit

Permalink
HiveServer2Hook: Support kwargs in get_pandas_df
Browse files Browse the repository at this point in the history
  • Loading branch information
22quinn committed Aug 5, 2020
1 parent 090f71a commit fa7192e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions airflow/providers/apache/hive/hooks/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,9 +1044,10 @@ def get_records(self, hql: Union[str, Text],
"""
return self.get_results(hql, schema=schema, hive_conf=hive_conf)['data']

def get_pandas_df(self, hql: Union[str, Text],
def get_pandas_df(self, hql: Union[str, Text], # type: ignore
schema: str = 'default',
hive_conf: Optional[Dict[Any, Any]] = None
hive_conf: Optional[Dict[Any, Any]] = None,
**kwargs
) -> pandas.DataFrame:
"""
Get a pandas dataframe from a Hive query
Expand All @@ -1069,6 +1070,6 @@ def get_pandas_df(self, hql: Union[str, Text],
:return: pandas.DateFrame
"""
res = self.get_results(hql, schema=schema, hive_conf=hive_conf)
df = pandas.DataFrame(res['data'])
df = pandas.DataFrame(res['data'], **kwargs)
df.columns = [c[0] for c in res['header']]
return df

0 comments on commit fa7192e

Please sign in to comment.