Skip to content

Commit 0cd8d9f

Browse files
authored
Merge pull request #6 from ttngu207/master
cleanup + formatting + adding `part` table for ephys
2 parents c79f997 + 8181f1b commit 0cd8d9f

11 files changed

+966
-432
lines changed

00-ConnectingToDatabase.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"source": [
109109
"For this workshop, some of the configuration values are pre-filled (e.g. `database.host` already points to the workshop database). Let's complete the configuration by specifying the username and password.\n",
110110
"\n",
111-
"Go ahead and open up the email you received when you signed up for the workshop. The email should contain your username (should be the same as your GitHub account username) and a randomly generated password. If you need the email to be resent, simply visit and signup again at https://datajoint.io/workshop."
111+
"Go ahead and enter the username and password of your [datajoint.io](https://datajoint.io) account below."
112112
]
113113
},
114114
{
@@ -241,7 +241,9 @@
241241
"cell_type": "markdown",
242242
"metadata": {},
243243
"source": [
244-
"When you signed up for the workshop at https://datajoint.io/workshop, you received a default, randomly generated password to connect to the database. It is recommended that you change this to something that you can remember better. You can do so easily using `dj.set_password` function."
244+
"The username and password used to connect to this tutorial database is that of your ***datajoint.io*** account, you can change this password on the [datajoint.io](https://datajoint.io) website. \n",
245+
"\n",
246+
"You can also directly change this database connection password using the `dj.set_password()` method. This is particularly useful if you are using DataJoint outside of this tutorial, where your ***datajoint.io*** credentials are not used for database connection."
245247
]
246248
},
247249
{
@@ -327,7 +329,7 @@
327329
"name": "python",
328330
"nbconvert_exporter": "python",
329331
"pygments_lexer": "ipython3",
330-
"version": "3.7.3"
332+
"version": "3.7.0"
331333
}
332334
},
333335
"nbformat": 4,

01-Getting started with DataJoint - Completed.ipynb

Lines changed: 90 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,7 +1749,7 @@
17491749
"cell_type": "markdown",
17501750
"metadata": {},
17511751
"source": [
1752-
"# Querying data"
1752+
"# Querying data from a single table"
17531753
]
17541754
},
17551755
{
@@ -1767,7 +1767,7 @@
17671767
"cell_type": "markdown",
17681768
"metadata": {},
17691769
"source": [
1770-
"## Restricting by attribute value"
1770+
"## Restrictions (`&`) - filter data with certain conditions"
17711771
]
17721772
},
17731773
{
@@ -3117,7 +3117,7 @@
31173117
"cell_type": "markdown",
31183118
"metadata": {},
31193119
"source": [
3120-
"## Negative restriction - with the `-` operator"
3120+
"## Negative restriction (`-`) - filter out data"
31213121
]
31223122
},
31233123
{
@@ -3464,85 +3464,7 @@
34643464
"cell_type": "markdown",
34653465
"metadata": {},
34663466
"source": [
3467-
"## Deleting entries"
3468-
]
3469-
},
3470-
{
3471-
"cell_type": "markdown",
3472-
"metadata": {},
3473-
"source": [
3474-
"Now we have a good idea on how to restrict table entries, this is a good time to introduce how to **delete** entries from a table."
3475-
]
3476-
},
3477-
{
3478-
"cell_type": "markdown",
3479-
"metadata": {},
3480-
"source": [
3481-
"To delete a specific entry, you restrict the table down to the target entry, and call `delete` method."
3482-
]
3483-
},
3484-
{
3485-
"cell_type": "code",
3486-
"execution_count": 45,
3487-
"metadata": {},
3488-
"outputs": [
3489-
{
3490-
"name": "stdout",
3491-
"output_type": "stream",
3492-
"text": [
3493-
"About to delete:\n",
3494-
"`test_`.`mouse`: 1 items\n",
3495-
"Proceed? [yes, No]: yes\n",
3496-
"Committed.\n"
3497-
]
3498-
}
3499-
],
3500-
"source": [
3501-
"(Mouse & 'mouse_id = 100').delete()"
3502-
]
3503-
},
3504-
{
3505-
"cell_type": "markdown",
3506-
"metadata": {},
3507-
"source": [
3508-
"Calling `delete` method on an *unrestricted* table will attempt to delete the whole table!"
3509-
]
3510-
},
3511-
{
3512-
"cell_type": "code",
3513-
"execution_count": 46,
3514-
"metadata": {},
3515-
"outputs": [
3516-
{
3517-
"name": "stdout",
3518-
"output_type": "stream",
3519-
"text": [
3520-
"About to delete:\n",
3521-
"`test_`.`session`: 3 items\n",
3522-
"`test_`.`mouse`: 11 items\n",
3523-
"Proceed? [yes, No]: No\n",
3524-
"Cancelled deletes.\n"
3525-
]
3526-
}
3527-
],
3528-
"source": [
3529-
"Mouse.delete()"
3530-
]
3531-
},
3532-
{
3533-
"cell_type": "markdown",
3534-
"metadata": {},
3535-
"source": [
3536-
"Notice that when you try to delete all `Mouse`, `delete` also warned that `Session` entries will get deleted! \n",
3537-
"\n",
3538-
"DataJoint understands and keeps track of dependencies such that **no dependent entries will be left orphaned**. The `delete` operations automatically **cascades down** the dependency to ensure data integrity. We will revisit this point in the next session."
3539-
]
3540-
},
3541-
{
3542-
"cell_type": "markdown",
3543-
"metadata": {},
3544-
"source": [
3545-
"## Joining tables"
3467+
"## Join (`*`) - gather information from different tables"
35463468
]
35473469
},
35483470
{
@@ -3950,7 +3872,13 @@
39503872
"cell_type": "markdown",
39513873
"metadata": {},
39523874
"source": [
3953-
"## Projection .proj(): focus on attributes of interest\n",
3875+
"## Projection (`.proj()`) - focus on attributes of interest"
3876+
]
3877+
},
3878+
{
3879+
"cell_type": "markdown",
3880+
"metadata": {},
3881+
"source": [
39543882
"Beside restriction (`&`) and join (`*`) operations, DataJoint offers another type of operation: projection (`.proj()`). Projection is used to select attributes (columns) from a table, to rename them, or to create new calculated attributes. "
39553883
]
39563884
},
@@ -4453,7 +4381,7 @@
44534381
"cell_type": "markdown",
44544382
"metadata": {},
44554383
"source": [
4456-
"## Fetch query results"
4384+
"# Fetch query results"
44574385
]
44584386
},
44594387
{
@@ -4755,6 +4683,84 @@
47554683
"(Mouse * Session & {'session_date': '2017-05-15'}).fetch1('KEY') # \"fetch1()\" because we know there's only one"
47564684
]
47574685
},
4686+
{
4687+
"cell_type": "markdown",
4688+
"metadata": {},
4689+
"source": [
4690+
"# Deletion (`.delete()`) - deleting entries and their dependencies"
4691+
]
4692+
},
4693+
{
4694+
"cell_type": "markdown",
4695+
"metadata": {},
4696+
"source": [
4697+
"Now we have a good idea on how to restrict table entries, this is a good time to introduce how to **delete** entries from a table."
4698+
]
4699+
},
4700+
{
4701+
"cell_type": "markdown",
4702+
"metadata": {},
4703+
"source": [
4704+
"To delete a specific entry, you restrict the table down to the target entry, and call `delete` method."
4705+
]
4706+
},
4707+
{
4708+
"cell_type": "code",
4709+
"execution_count": 45,
4710+
"metadata": {},
4711+
"outputs": [
4712+
{
4713+
"name": "stdout",
4714+
"output_type": "stream",
4715+
"text": [
4716+
"About to delete:\n",
4717+
"`test_`.`mouse`: 1 items\n",
4718+
"Proceed? [yes, No]: yes\n",
4719+
"Committed.\n"
4720+
]
4721+
}
4722+
],
4723+
"source": [
4724+
"(Mouse & 'mouse_id = 100').delete()"
4725+
]
4726+
},
4727+
{
4728+
"cell_type": "markdown",
4729+
"metadata": {},
4730+
"source": [
4731+
"Calling `delete` method on an *unrestricted* table will attempt to delete the whole table!"
4732+
]
4733+
},
4734+
{
4735+
"cell_type": "code",
4736+
"execution_count": 46,
4737+
"metadata": {},
4738+
"outputs": [
4739+
{
4740+
"name": "stdout",
4741+
"output_type": "stream",
4742+
"text": [
4743+
"About to delete:\n",
4744+
"`test_`.`session`: 3 items\n",
4745+
"`test_`.`mouse`: 11 items\n",
4746+
"Proceed? [yes, No]: No\n",
4747+
"Cancelled deletes.\n"
4748+
]
4749+
}
4750+
],
4751+
"source": [
4752+
"Mouse.delete()"
4753+
]
4754+
},
4755+
{
4756+
"cell_type": "markdown",
4757+
"metadata": {},
4758+
"source": [
4759+
"Notice that when you try to delete all `Mouse`, `delete` also warned that `Session` entries will get deleted! \n",
4760+
"\n",
4761+
"DataJoint understands and keeps track of dependencies such that **no dependent entries will be left orphaned**. The `delete` operations automatically **cascades down** the dependency to ensure data integrity. We will revisit this point in the next session."
4762+
]
4763+
},
47584764
{
47594765
"cell_type": "markdown",
47604766
"metadata": {},

0 commit comments

Comments
 (0)