bfeif commented on code in PR #34679:
URL: https://github.com/apache/airflow/pull/34679#discussion_r1367872541
##########
airflow/providers/common/sql/hooks/sql.py:
##########
@@ -218,6 +218,26 @@ def get_pandas_df(self, sql, parameters: Iterable |
Mapping[str, Any] | None = N
with closing(self.get_conn()) as conn:
return psql.read_sql(sql, con=conn, params=parameters, **kwargs)
+ def get_polars_df(self, sql, **kwargs):
+ """
+ Executes the sql and returns a polars dataframe.
+
+ :param sql: the sql statement to be executed (str) or a list of
+ sql statements to execute
+ :param parameters: The parameters to render the SQL query with.
+ :param kwargs: (optional) passed into polars.read_database method
+ """
+ try:
+ import polars as pl
+ except ImportError:
+ raise Exception(
+ "polars library not installed, run: pip install "
+ "'apache-airflow-providers-common-sql[polars]'."
+ )
+
+ with closing(self.get_conn()) as conn:
+ return pl.read_database(sql, connection=conn, **kwargs)
Review Comment:
It still seems to me to be over-engineering, at least for now @eladkal.
--
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]