| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| If you require additional control over how to read the CSV file, you can use | ||
| :py:class:`~datafusion.options.CsvReadOptions` to set a variety of options. | ||
|
|
||
| .. code-block:: python | ||
|
|
There was a problem hiding this comment.
I think it would be nice to have a link to docs.rs or similar that points to all available options for CsvReadOptions.
Sorry, something went wrong.
There was a problem hiding this comment.
Added
Sorry, something went wrong.
| terminator: Optional line terminator character. If ``None``, uses CRLF. | ||
| Must be a single ASCII character. |
There was a problem hiding this comment.
I'm surprised the default is CRLF.
Sorry, something went wrong.
There was a problem hiding this comment.
🤷
Sorry, something went wrong.
| csv_content = "name;age;city\nAlice;30;New York\nBob;25\n#Charlie;35;Paris" | ||
| csv_path.write_text(csv_content) | ||
|
|
||
| ctx = SessionContext() | ||
|
|
||
| # Test with CsvReadOptions | ||
| options = CsvReadOptions( | ||
| has_header=True, delimiter=";", comment="#", truncated_rows=True | ||
| ) |
There was a problem hiding this comment.
Should more parameters be tested? Like "quote", "truncated_rows", "compression", "null_regex", ...
Sorry, something went wrong.
There was a problem hiding this comment.
Added unit tests to cover all parameters. Good suggestion!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Which issue does this PR close?
Closes #1358
Rationale for this change
This change allows access to ALL csv reader options available in the upstream DataFusion repository. It adds a builder pattern on setting options for a more pleasant user experience, or they can specify each value individually in the constructor.
What changes are included in this PR?
Are there any user-facing changes?
This change is fully backwards compatible.