Conversation
alxmrs
left a comment
There was a problem hiding this comment.
Minor feedback, but overall, this seems like a great start for the REPL. I'm happy to chat with you about where to go next. Please review my notes and make fixes before merging.
|
|
||
| # Enable up/down arrow history for input() (Unix/Mac built-in; Windows: pip install pyreadline3) | ||
| try: | ||
| import readline # noqa: F401 |
There was a problem hiding this comment.
This package was deprecated in 2022. Check out https://pypi.org/project/gnureadline/.
There was a problem hiding this comment.
I like the idea of using a library to handle this instead of rolling it ourselves.
There was a problem hiding this comment.
Lets add this dep as an extra in the pyproject.toml.
| break | ||
|
|
||
| try: | ||
| result = ctx.sql(line).to_pandas() |
There was a problem hiding this comment.
I recommend using native datafusion dataframes over pandas. I think all we'd need to do here is to call collect() instead of to_pandas().
There was a problem hiding this comment.
I believe that datafusion naturally truncates long lines.
| except Exception as e: | ||
| print(f"Error: {e}", file=sys.stderr) |
There was a problem hiding this comment.
I'm torn if we should swallow and log errors or exit upon error. For now, this seems fine.
|
Hey @RohanDisa, I have a useful example for you: I'd love to match this CLI as closely as possible: https://lib.rs/crates/zarr-datafusion |
xarray_sql/repl.py: first early REPL run viapython -m xarray_sql.replair(xarray tutorialair_temperature, chunked) for quick testingxarray-sql>prompt; exit via.quit/.exitreadline; Windows needspyreadline3)Very early version; demo table is temporary and mainly for testing purposes