-
Notifications
You must be signed in to change notification settings - Fork 7
feat: Adding autodetect for CSV files. #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
==========================================
- Coverage 91.45% 91.36% -0.09%
==========================================
Files 44 46 +2
Lines 3464 3556 +92
==========================================
+ Hits 3168 3249 +81
- Misses 296 307 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| dict | ||
| File information including columns, detected format, size, and recommendations | ||
| """ | ||
| import duckdb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function could reside in csv_io.py. It doesn't need self, right?
| def _get_file_size(path: str | Path) -> int: | ||
| try: | ||
| return os.path.getsize(path) | ||
| except (OSError, FileNotFoundError): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you return an error if the file doesn't exist?
|
|
||
|
|
||
| @lru_cache(maxsize=32) | ||
| def _get_file_size(path: str | Path) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed? Wouldn't it be risky? It seems like someone could change the file during a session.
| """ | ||
| return self.ingest_from_csvs((path,), src_schema, dst_schema, connection=connection) | ||
| if _should_use_auto_detect(auto_detect) and _is_large_file(path): | ||
| logger.info(f"Processing large file {path} with auto-detection optimizations") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the optimization?
No description provided.