CSV to Postgres


Download branch csv_postgres2. Modify the database.yml or application.yml to fit your need

IMP: Make sure your gemfile has "activerecord-import" and "smartercsv" for your appropriate environment before starting the process.

  1. Export the latest Headers, Hros, Notes, Pseudo Streets, Signs with XYs, Standards with categories, subcategories from the database to individual Flat files. Make sure they all have tab "\t" delimiter on column level and "{CR}{LF}" on Rows.

  2. Make sure the files names follow this conventions:

    • headers.csv
    • hros.csv
    • notes.csv
    • pseudo_streets.csv
    • signs_with_xys.csv
    • standards_with_categories.csv
    • subcategories.csv
  1. Transfer the files to the "db\/data" in the sims app.

  2. Navigate to the "bin\/loaders\/csv_postgres_new"

  3. Open 7 screens on same working directory(This is not necessary but signs_with_xys, notes and headers are recommended to be executed in individual screens.)

  4. run each files with ruby command on individual screens.

     ruby headers.csv.rb #on Screen 1
     ruby hros.csv.rb #on Screen 2
     ruby notes.csv.rb #on Screen 3
     ruby pseudo_streets.rb #on Screen 4
     ruby signs_with_xys.rb #on Screen 5
     ruby standards_with_categories.rb #on Screen 6
     ruby subcategories.rb #on Screen 7
    

NOTE: Running some of the files in a different screen is kind of overkill since it might take few seconds to run the process but just trying to be safe. You are free to use any number of screens.


results matching ""

    No results matching ""