Title: export_csv drops fields that are missing from the first record · Issue #53 · brightdata/sdk-python · GitHub
Open Graph Title: export_csv drops fields that are missing from the first record · Issue #53 · brightdata/sdk-python
X Title: export_csv drops fields that are missing from the first record · Issue #53 · brightdata/sdk-python
Description: export_csv builds the column list from the first record only: if fields is None: fields = list(data[0].keys()) Rows are then built by looking up fields on each record, so a key that appears on any later record is never written and nothin...
Open Graph Description: export_csv builds the column list from the first record only: if fields is None: fields = list(data[0].keys()) Rows are then built by looking up fields on each record, so a key that appears on any ...
X Description: export_csv builds the column list from the first record only: if fields is None: fields = list(data[0].keys()) Rows are then built by looking up fields on each record, so a key that appears on any ...
Opengraph URL: https://github.com/brightdata/sdk-python/issues/53
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"export_csv drops fields that are missing from the first record","articleBody":"`export_csv` builds the column list from the first record only:\n\n```python\nif fields is None:\n fields = list(data[0].keys())\n```\n\nRows are then built by looking up `fields` on each record, so a key that appears on any later record is never written and nothing is raised.\n\n```python\nfrom brightdata.datasets.utils import export_csv\n\ndata = [\n {\"url\": \"a.com\", \"price\": 10},\n {\"url\": \"b.com\", \"price\": 20, \"discount\": \"50%\"},\n]\nexport_csv(data, \"out.csv\")\n```\n\nout.csv:\n\n```\nurl,price\na.com,10\nb.com,20\n```\n\n`discount` is gone with no warning. Scraper results are commonly heterogeneous, since optional fields are absent when a page does not have them, so this loses real data on ordinary output. `export_json` and `export_jsonl` keep every key, so the same result set exports differently depending on format.\n\nTaking the union of keys across all records, in first-seen order, would fix it. Happy to send a PR.","author":{"url":"https://github.com/chiruu12","@type":"Person","name":"chiruu12"},"datePublished":"2026-08-15T12:44:22Z","url":"https://github.com/brightdata/sdk-python/issues/53"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5e8a9cf3-8609-bbcf-0f9c-c13605d3516a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C488:3134C2:91C9A7:CC09E3:6B042A88 |
| html-safe-nonce | 481ea0d43a01e1afe4cf48827a68a567f62f15b78317660078c67df231d9d7c4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDg4OjMxMzRDMjo5MUM5QTc6Q0MwOUUzOjZCMDQyQTg4IiwidmlzaXRvcl9pZCI6IjU2OTkyMDQwMjkxMzQxNTQzNzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f604b414b7db854898a664ba9f8b4391e7aa7b35220a272cd3d7bea0c860767d |
| hovercard-subject-tag | issue:5159419854 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/brightdata/sdk-python/53/issue_layout |
| twitter:image | https://opengraph.githubassets.com/02c8ff257b37138a15a2b0a65675737d94ad8f5a389fd8d439156e140c390929/brightdata/sdk-python/issues/53 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/02c8ff257b37138a15a2b0a65675737d94ad8f5a389fd8d439156e140c390929/brightdata/sdk-python/issues/53 |
| og:image:alt | export_csv builds the column list from the first record only: if fields is None: fields = list(data[0].keys()) Rows are then built by looking up fields on each record, so a key that appears on any ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chiruu12 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b7a1d2b9101496921b08579fbee988d014345aef2f5bd660d1f8c7332d81560e |
| turbo-cache-control | no-preview |
| go-import | github.com/brightdata/sdk-python git https://github.com/brightdata/sdk-python.git |
| octolytics-dimension-user_id | 213028976 |
| octolytics-dimension-user_login | brightdata |
| octolytics-dimension-repository_id | 1033685757 |
| octolytics-dimension-repository_nwo | brightdata/sdk-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1033685757 |
| octolytics-dimension-repository_network_root_nwo | brightdata/sdk-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c3dd496c3da6ea6b77e69c09279d2b81604654f1 |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width