kosiew commented on code in PR #1247:
URL: 
https://github.com/apache/datafusion-python/pull/1247#discussion_r2370817439


##########
docs/source/user-guide/dataframe/index.rst:
##########
@@ -228,6 +228,33 @@ Core Classes
     * :py:meth:`~datafusion.SessionContext.from_pandas` - Create from Pandas 
DataFrame
     * :py:meth:`~datafusion.SessionContext.from_arrow` - Create from Arrow data
 
+    ``SessionContext`` can automatically resolve SQL table names that match
+    in-scope Python data objects. When automatic lookup is enabled, a query
+    such as ``ctx.sql("SELECT * FROM pdf")`` will register a pandas or
+    PyArrow object named ``pdf`` without calling
+    :py:meth:`~datafusion.SessionContext.from_pandas` or
+    :py:meth:`~datafusion.SessionContext.from_arrow` explicitly. This requires
+    the corresponding library (``pandas`` for pandas objects, ``pyarrow`` for
+    Arrow objects) to be installed.
+
+    .. code-block:: python
+
+        import pandas as pd
+        from datafusion import SessionContext
+
+        ctx = SessionContext(auto_register_python_objects=True)

Review Comment:
   Flipping this on by default would change long-standing failure modes—queries 
that currently raise “table not found” would start consulting the caller’s 
scope, which could mask mistakes or introduce non-deterministic behavior when 
multiple similarly named objects exist. 
   Because the feature walks Python stack frames, leaving it opt-in keeps that 
overhead and surprise factor away from existing users. I’m open to amending the 
flag name later; I chose auto_register_python_objects to make the opt-in 
explicit, but we can follow up if we find a cleaner alias that still 
differentiates it from the existing python_table_lookup config switch.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to