Skip to content
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

CSV import does not handle empty field / NULL correctly #189

Closed
neilotoole opened this issue Apr 9, 2023 · 1 comment
Closed

CSV import does not handle empty field / NULL correctly #189

neilotoole opened this issue Apr 9, 2023 · 1 comment

Comments

@neilotoole
Copy link
Owner

Describe the bug

CSV empty fields should be handled as NULL, not empty string.

To Reproduce

$ cat address.csv | sq '.data | .[:5]'
address_id  address               address2  district  city_id  postal_code  phone  last_update
1           47 MySakila Drive                         300      NULL                2020-02-15T06:59:28Z
2           28 MySQL Boulevard                        576      NULL                2020-02-15T06:59:28Z
3           23 Workhaven Lane                         300      NULL                2020-02-15T06:59:28Z
4           1411 Lillydale Drive                      576      NULL                2020-02-15T06:59:28Z
5           1913 Hanoi Way                            463      35200               2020-02-15T06:59:28Z

In JSON:

{"address_id": 1, "address": "47 MySakila Drive", "address2": "", "district": "", "city_id": 300, "postal_code": null, "phone": "", "last_update": "2020-02-15T06:59:28Z"}
{"address_id": 2, "address": "28 MySQL Boulevard", "address2": "", "district": "", "city_id": 576, "postal_code": null, "phone": "", "last_update": "2020-02-15T06:59:28Z"}
{"address_id": 3, "address": "23 Workhaven Lane", "address2": "", "district": "", "city_id": 300, "postal_code": null, "phone": "", "last_update": "2020-02-15T06:59:28Z"}
{"address_id": 4, "address": "1411 Lillydale Drive", "address2": "", "district": "", "city_id": 576, "postal_code": null, "phone": "", "last_update": "2020-02-15T06:59:28Z"}
{"address_id": 5, "address": "1913 Hanoi Way", "address2": "", "district": "", "city_id": 463, "postal_code": 35200, "phone": "", "last_update": "2020-02-15T06:59:28Z"}

Expected behavior
I expected the address2 and district fields to be null in the example above.

@neilotoole
Copy link
Owner Author

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant