Sometimes the use of CLI is not possible since we need to use custom fields. It'd awesome to have a way to define custom Field classes and pass the related Python file with the definitions to the CLI so it'll use it when importing/exporting data.
The use case could be something like:
I create a file named custom_fields.py with the following code:
import rows
class BrazilianDecimalField(rows.fields.DecimalField):
name = "brazilian-decimal"
- I create a file `my-file.csv` with some data, including numbers formatted in Brazilian;
- I create a file `my-schema.csv` using `brazilian-decimal` as `field_type` for a column;
- I run `rows pgimport --fields-context=custom_fields my-file.csv $POSTGRESQL_URI my_table`.
Sometimes the use of CLI is not possible since we need to use custom fields. It'd awesome to have a way to define custom
Field
classes and pass the related Python file with the definitions to the CLI so it'll use it when importing/exporting data.The use case could be something like:
custom_fields.py
with the following code:class BrazilianDecimalField(rows.fields.DecimalField): name = "brazilian-decimal"