csv_to_sqlite should convert values according to schema
Open
@turicas is already working on this.
Since Feb 15, 2019.
bug
- Dominant language
- Python
- Stars
- 886
- Forks
- 137
- PR merge metrics
- No merged PRs in 30d
Description
If the schema is detected or specified, the rows.utils.csv_to_sqlite function must use the field classes to convert the values before exporting to SQL.
To reproduce the bug, create two files:
echo -e "value\n123\n \n456" > data.csv
echo -e "field_name,field_type\nvalue,decimal" > test-schema.csv
Then, call the function via CLI:
rows csv2sqlite --schemas=test-schema.csv data.csv data.sqlite
# Prints: "ValueError: could not convert string to float: "
Note: doing this conversion always will slow down the process, but is the more robust way of converting if a schema file is specified (not the case when schema is detect). May add a
--convert-from-schemaparameter to run this conversion.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.