You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add optional fields and streaming CSV parser with comprehensive tests
- Add optional fields (email, bio, title, published) to test table schemas
- Add csv-parse dependency for robust CSV header parsing
- Replace naive CSV header parsing with streaming csv-parse implementation
- Handles BOM, CRLF/LF line endings
- Properly parses quoted commas and escaped quotes
- Validates column names against SQL identifier rules
- Normalizes headers to snake_case lowercase
- Reads only first record (header) for efficiency with large files
- Create comprehensive test cases:
- posts-with-optional.csv: CSV with optional fields populated
- posts-quoted-commas.csv: CSV with quoted commas in fields
- posts-escaped-quotes.csv: CSV with escaped quotes in fields
- postgres-test.csv-optional-fields.test.ts: Test optional fields
- postgres-test.csv-edge-cases.test.ts: Test quoted commas and escaped quotes
- All 5 CSV tests passing (csv, csv-subset-header, csv-optional-fields, csv-edge-cases)
Co-Authored-By: Dan Lynch <pyramation@gmail.com>
0 commit comments