Hi Team,
When I work on the social network database programming assignment first task to load the csv in the database, I created a separate cell to test my logic and I can see the DB gets populated, however, when I run with the unit test, it shows no record created. Can someone advise what might be the issue? Thanks
Generative AI for Software Development Week 3 Programming Assignment: Social Network Database
Hi @bioceansailor ,
It could be the execution environment is not up-to-date. Try refresh the kernel and rerun the code cells from start.
From the menu bar at the top of your notebook, click:
kernel->restart & clear all output
cell → run all above (from your current cell)
Hi Kin,
Thanks for the quick response and guideline. I did the clean up and re-run the cell. My function output is the same as the expected result:
Not sure the test cell execution return empty. Your insight is highly appreciated.
My function unit test output: load_data_from_csv(session, Club, Person, friendships, club_members, csv_path=“members.csv”):
== All Persons ===
ID: 1, Name: John Rocha, Age: 57, Gender: Male, Location: 948 Christian Park Apt. 683 New Christopher, MN 06675
ID: 2, Name: William Ruiz, Age: 42, Gender: Female, Location: 09477 Paul Station Williamsmouth, NM 93899
ID: 3, Name: Jackie Mccullough, Age: 36, Gender: Non-binary, Location: 903 Keller River Suite 149 Davidside, IN 11476
=== All Clubs and their Members ===
Club ID: 1, Description: Fitness Club, Members: [‘John Rocha’, ‘Amanda Norris’, ‘Michael Clark’, ‘Christina Murphy’]
Club ID: 2, Description: Travel Club, Members: [‘William Ruiz’, ‘Michael Powell’, ‘Becky Peterson’, ‘Nicholas Harrington’, ‘Luis Kim’, ‘Nathan Mendez’]
Club ID: 3, Description: Art Club, Members: [‘William Ruiz’, ‘Jackie Mccullough’, ‘Amanda Norris’, ‘Becky Peterson’, ‘Mark Allen’, ‘Brian Mays’, ‘Eric Dougherty’, ‘Nathan Mendez’]
=== Friendships ===
John Rocha’s Friends: [‘Scott Boyd’, ‘Andrew Williams’, ‘Nicholas Harrington’, ‘Christina Murphy’, ‘Luis Kim’, ‘Mark Mcintyre’]
William Ruiz’s Friends: [‘Michael Powell’, ‘Mark Allen’, ‘Nicholas Harrington’, ‘Brian Mays’, ‘Nathan Mendez’]
Jackie Mccullough’s Friends: [‘Scott Boyd’, ‘Amanda Norris’, ‘Mark Allen’, ‘Nicholas Harrington’]
The code below creates the database and reads in the data
session, Club, Person, friendships, club_members = create_database()
load_data_from_csv(session, Club, Person, friendships, club_members, “members.csv”)
=== All Persons ===
=== All Clubs and their Members ===
=== Friendships ===
Expected output:
=== All Persons ===
ID: 0, Name: John Rocha, Age: 57, Gender: Male, Location: 948 Christian Park Apt. 683 New Christopher, MN 06675
ID: 1, Name: William Ruiz, Age: 42, Gender: Female, Location: 09477 Paul Station Williamsmouth, NM 93899
ID: 2, Name: Jackie Mccullough, Age: 36, Gender: Non-binary, Location: 903 Keller River Suite 149 Davidside, IN 11476
=== All Clubs and their Members ===
Club ID: 1, Description: Fitness Club, Members: [‘John Rocha’, ‘Amanda Norris’, ‘Michael Clark’, ‘Christina Murphy’]
Club ID: 2, Description: Travel Club, Members: [‘William Ruiz’, ‘Michael Powell’, ‘Becky Peterson’, ‘Nicholas Harrington’, ‘Luis Kim’, ‘Nathan Mendez’]
Club ID: 3, Description: Art Club, Members: [‘William Ruiz’, ‘Jackie Mccullough’, ‘Amanda Norris’, ‘Becky Peterson’, ‘Mark Allen’, ‘Brian Mays’, ‘Eric Dougherty’, ‘Nathan Mendez’]
=== Friendships ===
John Rocha’s Friends: [‘Scott Boyd’, ‘Andrew Williams’, ‘Nicholas Harrington’, ‘Christina Murphy’, ‘Luis Kim’, ‘Mark Mcintyre’]
William Ruiz’s Friends: [‘Michael Powell’, ‘Mark Allen’, ‘Nicholas Harrington’, ‘Brian Mays’, ‘Nathan Mendez’]
Jackie Mccullough’s Friends: [‘Scott Boyd’, ‘Amanda Norris’, ‘Mark Allen’, ‘Nicholas Harrington’]
Thanks Kin. Please review the attached Jupyter code.
This line is probably an issue for the grader. Can you revert to the original state; session, Club, Person, friendships = load_dataset() and try again?
you can get the default file by deleting the current one ( save it first with another name) and do “Get Latest Version”.
Hi @bioceansailor ,
You have not added any code for ex2, ex3 and ex4. What is there for each of these exercises is just a shell. You need to remov the ‘pass’ under ### START ADDING CODE HERE ### and replace it with your code .
Thanks Kin. The issue is resolved now.