guan404ming commented on code in PR #50454:
URL: https://github.com/apache/airflow/pull/50454#discussion_r2083501851
##########
providers/elasticsearch/tests/unit/elasticsearch/hooks/test_elasticsearch.py:
##########
@@ -177,6 +177,10 @@ def test_get_df_pandas(self):
self.spy_agency.assert_spy_called(self.cur.close)
self.spy_agency.assert_spy_called(self.cur.execute)
+ def test_get_df_polars(self):
Review Comment:
Since the `ElasticsearchSQLHook`has its own `ElasticsearchSQLCursor` which
is not compatable with polars thus if we try like
```python
@pytest.mark.parametrize(
"df_type",
["pandas", "polars"],
)
def test_get_df(self, df_type):
statement = "SELECT * FROM hollywood.actors"
df = self.db_hook.get_df(statement, df_type=df_type)
assert list(df.columns) == ["index", "name", "firstname", "age"]
assert df.values.tolist() == ROWS
self.conn.close.assert_called_once_with()
self.spy_agency.assert_spy_called(self.cur.close)
self.spy_agency.assert_spy_called(self.cur.execute)
```
would get this error
```
___________________________________________________________
TestElasticsearchSQLHook.test_get_df[polars]
___________________________________________________________
providers/elasticsearch/tests/unit/elasticsearch/hooks/test_elasticsearch.py:175:
in test_get_df
df = self.db_hook.get_df(statement, df_type=df_type)
providers/common/sql/src/airflow/providers/common/sql/hooks/sql.py:458: in
get_df
return self._get_polars_df(sql, parameters, **kwargs)
providers/common/sql/src/airflow/providers/common/sql/hooks/sql.py:513: in
_get_polars_df
return pl.read_database(sql, connection=conn,
execute_options=execute_options, **kwargs)
.venv/lib/python3.12/site-packages/polars/io/database/functions.py:251: in
read_database
).to_polars(
.venv/lib/python3.12/site-packages/polars/io/database/_executor.py:563: in
to_polars
raise NotImplementedError(msg)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]