Skip to content

abiram31/import-users

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Import Users

A Python script to import user data.

Installation

  1. Clone the repository:
git clone https://github.com/abiram31/import-users.git

Usage

Requirements

  • Ensure you have Python 3.8+ installed.

Command Line Arguments

  • --users: Path to the useraccounts csv file
  • --passwords: Path to the passwords csv file
  • --schema: Path to the sql file with users schema
  • --emailsuffix: email suffix to be added after username (e.g. @clearcable.ca)
  • --accountprefix: prefix to be added before account number (e.g. 001-)

Run the script with:

python import_users.py --users <users.csv> --passwords <passwords.csv> --schema <schema.sql> --emailsuffix <emailsuffix> --accountprefix <accountprefix>

example bash:

python import_users.py --users useraccounts.csv --passwords passwords.csv --schema createUsersTable.sql --emailsuffix @clearcable.ca --accountprefix 001-

example bash using uv:

uv run python import_users.py --users useraccounts.csv --passwords passwords.csv --schema createUsersTable.sql --emailsuffix @clearcable.ca --accountprefix 001-

Assumptions and Notes

  • If a username doesnt have a corresponding password in the passwords file, the password is set to null in the database
  • If a user exists in the passsword file, but is not in the users file, the user is added to the database with null as the value for accountnumber, email, phonenumber and address
  • The username column name is the same in both CSV files
  • The files may be very large, so avoided saving to memory
  • the 2 csv files, schema, the email suffix and the account prefix is required

Input File formats

Users CSV (useraccounts.csv)

Required columns:

accountnumber, Username, phonenumber, address

Passwords CSV (passwords.csv)

Required columns:

Username, Password

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages