Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Wheels — Import

Import wheel products from a CSV file. Automatically resolves human-readable names to database IDs, generates part numbers and descriptions, creates molds if needed, and inserts products in a single transaction.

Usage: efision -r <region> wheels import <file> [--dry-run]
FlagDefaultDescription
--dry-runfalseValidate and preview without inserting

CSV Format

All 16 columns are required in the header. See the table below for which values can be empty.

brand,model,diameter,width,profile,directional,holes,pcd1,pcd2,et,cb,bolt,cap,base_finish,procedures,status
INOVIT,Speed,19,9.5,0,,5,112,,40,73.1,32x15x60,CP506AL68,Black,"Machined Face,Dark Tint,Satin Lacquer",inactive
Hartes Metal,Strike,22,12.0,0,,8,165.1,,-44,125.2,34x16x60,CP708PS130,Black,Milled Dimple,inactive
ColumnTypeCan be emptyEmpty default
brandstringNo
modelstringNo
diameterintNo
widthfloatNo
profileintYes0
directionalstringYes“” (non-directional)
holesintNo
pcd1stringNo
pcd2stringYes“” (single PCD)
etintNo
cbfloatNo
boltstringNo
capstringNo
base_finishstringNo
proceduresstringYes“” (no procedures)
statusstringNoactive/inactive/1/0

Name Resolution

Brand, model, bolt, cap, finish, and procedure names are resolved to database IDs. The model column matches against both pdName and pdNO in ProductDesign.

Workflow

  1. Parses CSV and validates required fields
  2. Resolves all names to database IDs (with in-memory caching)
  3. Auto-creates ProductMold if no mold exists for the design + diameter + width combination
  4. Generates part numbers using the V1 formula (same as check-pn)
  5. Generates descriptions (same formula as batch-update)
  6. Checks for duplicate specs already in the database (skips duplicates)
  7. Shows a preview table with generated part numbers
  8. If --dry-run: stops here
  9. Prompts for confirmation (y/N)
  10. Inserts Product + ProductWheels + CategoryProduct in a single transaction
  11. Links design-level appendant categories (ProductAndMoldAppendant)

Examples

Dry run (validate only):

efision -r us wheels import new-wheels.csv --dry-run
Efision Wheels Import
============================================================

Region: US
Mode:   Dry run (no changes)
File:   new-wheels.csv

Parsed 41 row(s) from CSV

41 wheel(s) to import:

 #  Brand         Model      Size    HxPCD         ET   CB      Finish  Procedures                     Status    Part Number
 1  INOVIT        Speed      19x9.5  5x112         40   73.10   Black   Machined Face/Dark Tint/...    Inactive  02319M5T40KMFTDTM1ANA
 2  INOVIT        Speed      20x10   5x120         40   72.60   Black   Machined Face/Dark Tint/...    Inactive  02320N5B40KMFTDTM1BNA
 ...

Dry run complete. Run without --dry-run to import.

Import with duplicate detection:

efision -r us wheels import new-wheels.csv
3 row(s) have duplicate specs already in database:
 Row  Existing pID  Existing PN
 5    14580         02319M5TF38KMFTDTM1ANA
 ...

38 wheel(s) to import:
 ...

Import 38 wheel product(s) into US region? [y/N] yes

Successfully imported 38 wheel product(s)!

Errors shown for unresolvable values:

efision -r demo wheels import bad-data.csv --dry-run
2 row(s) have errors:

 Row  Field  Error
 5    bolt   bolt '29x15x60' not found
 8    model  model 'NewDesign' not found for brand 'INOVIT'

Notes

  • All inserts execute within a single database transaction (all-or-nothing)
  • Part numbers are generated using the same V1 formula as check-pn
  • Molds are auto-created when a design + size combination doesn’t exist yet (initial ET/PCD/CB ranges set to the row’s values)
  • Duplicate specs (matching design + all wheel specs) are detected and skipped, not rejected
  • procedures uses comma-separated names (e.g. "Machined Face,Dark Tint,Satin Lacquer"), same as batch-update
  • brand must match ProductBrand.pbName exactly; model matches ProductDesign.pdName or pdNO
  • Lookup errors (missing bolt, cap, finish, procedure, PCD code, CB code, width code) are reported per-row with the specific field and value that failed