Skip to content

Commit

Permalink
pop-db: skip headers
Browse files Browse the repository at this point in the history
Problem: Now that export-db can format custom output and includes a
header, the pop-db command should expect a header when populating the
DB with user and bank information.

Add skips of the both the banks .csv files and users .csv files when
reading from them.
  • Loading branch information
cmoussa1 committed Nov 7, 2024
1 parent bb5533b commit 464116d
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def populate_db(conn, users=None, banks=None):
try:
with open(banks) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=",")
headers = next(csv_reader)

for row in csv_reader:
b.add_bank(
Expand All @@ -91,6 +92,7 @@ def populate_db(conn, users=None, banks=None):
try:
with open(users) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=",")
headers = next(csv_reader)

# assign default values to fields if
# their slot is empty in the csv file
Expand Down

0 comments on commit 464116d

Please sign in to comment.