Skip to content

Import | Import numbers as string if the schema is v.string() #137

Open
@mmailaender

Description

@mmailaender

I have the following csv

"accountNumber","accountName"
"0001","reserviert"
"0040","reserviert"

accountNumber is v.string() in convex (to preserver the leading 0), so importing via npx convex import --table accounts accounts.csv fails because the importer tries to import accountNumber as v.number.

Failed to insert or update a document in table "accounts" because it does not match the schema: Value does not match validator.
Path: .accountNumber
Value: 1.0
Validator: v.string()

So instead I would expect that the importer tries to cast the values to the format of the field. Or at least treat everything as string and if the target field is of type v.number try to cast the string to number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions