tespent opened a new issue, #1103:
URL: https://github.com/apache/datafusion-python/issues/1103

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   <!--A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to  the *what*)-->
   
   I am trying to integrate a SQL engine (and I chose DataFusion in the end!) 
into our system (based on Ray Data), to enable our users to retrieve and select 
data using SQL. We already have production-ready Python-interfaced catalog 
providers and file readers. I am attempting to use the datafusion-python 
library to work with these custom catalogs, but I’ve run into an issue: the 
Python API does not currently provide a way to implement or write a custom 
CatalogProvider. This is preventing me from extending DataFusion to interact 
with existing catalog sources in Python. Without this functionality, 
integrating existing custom catalogs becomes difficult, especially in a dynamic 
or production-level environment where flexibility in data source management is 
key.
   
   **Describe the solution you'd like**
   <!-- A clear and concise description of what you want to happen. -->
   
   As of now, I've had to write custom rust bindings for python objects. These 
bindings are generic enough to fit into the datafusion-python project as it 
simply wraps python objects to implement `CatalogProvider`, `SchemaProvider`, 
`TableProvider`, `ExecutionPlan`, `RecordBatchStream` and more, and extended 
many existed bindings to expose more information from rust to python. I would 
like to contribute my solution and code to datafusion-python to implement this 
feature!
   
   **Describe alternatives you've considered**
   <!-- A clear and concise description of any alternative solutions or 
features you've considered. -->
   
   Based on the existing API, we can first fetch the data, then run a sql 
against it using something like `from_arrow` or `create_dataframe` (similar to 
[smallpond](https://github.com/deepseek-ai/smallpond)'s `partial_sql` but they 
are using DuckDB). However, this solution has many drawbacks:
   1. Users are required to separate data fetching logic and the sql query, 
which negatively impacts user experience.
   2. Pushdowns will not work. So end users will need to properly write filters 
and column selections for our datasource.
   3. The existing conversion APIs require all the data to be ready before 
processing, which breaks data pipelines and leads to high memory usage, as we 
have to buffer all the data.
   
   **Additional context**
   <!-- Add any other context or screenshots about the feature request here. -->
   
   This feature would be beneficial for anyone looking to use datafusion-python 
in environments with existing python data sources, or non-standard data sources 
based on python, such as custom databases, external APIs, or even customized 
cloud-based storage systems. This feature can help DataFusion better embrace 
the python ecosystem, and benefit the DataFusion community by providing a 
easier way to prototype customized catalogs (data sources) using python, which 
is a great glue language for integrating things! By offering this feature, 
framework developers can easily integrate DataFusion into their python-based 
systems (like Ray Data and other data processing frameworks), empowering these 
systems with extensible and advanced SQL functionalities!
   
   This feature may also be related to #24, as it involves 
`SessionContext.register_catalog`, which has not yet been implemented.


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to