Skip to content

Commit

Permalink
Fixes for running notebooks up to 41
Browse files Browse the repository at this point in the history
  • Loading branch information
CBroz1 committed Feb 7, 2024
1 parent f8f3723 commit cc86acf
Show file tree
Hide file tree
Showing 26 changed files with 434 additions and 601 deletions.
68 changes: 66 additions & 2 deletions notebooks/01_Insert_Data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,9 @@
"metadata": {},
"outputs": [],
"source": [
"team_name = \"My Team\"\n",
"sgc.LabTeam().create_new_team(\n",
" team_name=\"My Team\", # Should be unique\n",
" team_name=team_name, # Should be unique\n",
" team_members=[\"Firstname Lastname\", \"Firstname2 Lastname2\"],\n",
" team_description=\"test\", # Optional\n",
")"
Expand Down Expand Up @@ -2252,6 +2253,69 @@
"session_entry"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"`Session.Experimenter` is used for permissions checks when deleting. The\n",
"session will need to have an experimenter in order avoid an error being\n",
"raised during this check.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sess_key = (sgc.Session & {\"nwb_file_name\": nwb_copy_file_name}).fetch(\n",
" \"KEY\", as_dict=True\n",
")[0]\n",
"exp_key = (sgc.LabMember).fetch(\"KEY\", as_dict=True)[0]\n",
"sgc.Session.Experimenter.insert1(\n",
" dict(**sess_key, **exp_key), skip_duplicates=True\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Even with the experimenter specified, there are still delete protections\n",
"in place. To see an example, uncomment the cell below.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# session_entry.delete()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To delete, you'll need to share a team with the session experimenter.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"your_name = \"YourFirst YourLast\"\n",
"parts = your_name.split(\" \")\n",
"sgc.LabMember.insert1([your_name, parts[0], parts[1]])\n",
"sgc.LabMember.LabMemberInfo.insert1(\n",
" [your_name, \"your_gmail\", dj.config[\"database.user\"], 0]\n",
")\n",
"sgc.LabTeam.LabTeamMember.insert1([team_name, your_name])"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -2311,7 +2375,7 @@
}
],
"source": [
"session_entry.delete()"
"# session_entry.delete()"
]
},
{
Expand Down
Loading

0 comments on commit cc86acf

Please sign in to comment.