Skip to content

Commit 29ea931

Browse files
committed
codespell and black
1 parent 1860626 commit 29ea931

File tree

7 files changed

+176
-134
lines changed

7 files changed

+176
-134
lines changed

db-course/003-ForeignKeys.ipynb

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Referential integrity"
7+
"# Referential integrity\n"
88
]
99
},
1010
{
@@ -13,40 +13,41 @@
1313
"source": [
1414
"## Referential integrity\n",
1515
"\n",
16-
"* Correcting matching of corresponding entities across the schema\n",
17-
"* Relies on entity integrity\n",
18-
"* Enfornced by foreign keys\n",
16+
"- Correcting matching of corresponding entities across the schema\n",
17+
"- Relies on entity integrity\n",
18+
"- Enforced by foreign keys\n",
1919
"\n",
2020
"## Foreign keys\n",
21-
"A foreign key is a column or several columns in the child table referencing the primary key column(s) in the parent table.\n",
2221
"\n",
23-
"* More generally, foreign keys can reference other sets of columns than the primary key. However, in common practice and in this class foreign keys will always reference the primary key in the referenced table.\n",
22+
"A foreign key is a column or several columns in the child table referencing the primary key column(s) in the parent table.\n",
2423
"\n",
24+
"- More generally, foreign keys can reference other sets of columns than the primary key. However, in common practice and in this class foreign keys will always reference the primary key in the referenced table.\n",
2525
"\n",
2626
"## Effects of a foreign key constraint\n",
27+
"\n",
2728
"1. Restrict inserts into the child table if there is no match in parent.\n",
2829
"2. Restrict deletes (and updates of primary key values) from the parent table when there is a match in child.\n",
2930
"3. An index is created in the child table to speed up searches on the foreign key.\n",
3031
"\n",
3132
"As a result, the child table is prevented from having values in its foreign keys columns in the absence of entries in the parent table with matching primary key values.\n",
3233
"\n",
33-
"Importantly, unlike other types of links in other data models, no actual link is created between individual rows of both tables. Referential integrity is maintained by restricting dta manipulations."
34+
"Importantly, unlike other types of links in other data models, no actual link is created between individual rows of both tables. Referential integrity is maintained by restricting dta manipulations.\n"
3435
]
3536
},
3637
{
3738
"cell_type": "markdown",
3839
"metadata": {},
3940
"source": [
40-
"## Diagramming notation \n",
41+
"## Diagramming notation\n",
4142
"\n",
42-
"- Entity-relationship diagram"
43+
"- Entity-relationship diagram\n"
4344
]
4445
},
4546
{
4647
"cell_type": "markdown",
4748
"metadata": {},
4849
"source": [
49-
"## Examples"
50+
"## Examples\n"
5051
]
5152
},
5253
{
@@ -420,10 +421,11 @@
420421
"metadata": {},
421422
"source": [
422423
"## Foreign keys have 4 effects\n",
424+
"\n",
423425
"0. The primary key of the parent becomes part of the child definition (the foreign key)\n",
424426
"1. Restrict inserts into child table if no match in parent\n",
425-
"2. Restrict deletes from parent if there is a matching child \n",
426-
"3. Create an index in child to make searches fast on the value of the FK value."
427+
"2. Restrict deletes from parent if there is a matching child\n",
428+
"3. Create an index in child to make searches fast on the value of the FK value.\n"
427429
]
428430
},
429431
{

db-course/003-Indexes.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@
1414
"\n",
1515
"In DataJoint, indexes are created by one of the three mechanisms:\n",
1616
"\n",
17-
"1. Primary key \n",
18-
"2. Foreign key \n",
17+
"1. Primary key\n",
18+
"2. Foreign key\n",
1919
"3. Explicitly defined indexes\n",
2020
"\n",
21-
"The first two mechanisms are obligatory. Every table has a primary key, which serves as an unique index. Therefore, restrictions by a primary key are very fast. Foreign keys create additional indexes unless a suitable index already exists."
21+
"The first two mechanisms are obligatory. Every table has a primary key, which serves as an unique index. Therefore, restrictions by a primary key are very fast. Foreign keys create additional indexes unless a suitable index already exists.\n"
2222
]
2323
},
2424
{
2525
"cell_type": "markdown",
2626
"metadata": {},
2727
"source": [
28-
"Let's test this principle. Let's create a table with a 10,000 entries and compare lookup times:"
28+
"Let's test this principle. Let's create a table with a 10,000 entries and compare lookup times:\n"
2929
]
3030
},
3131
{
@@ -61,7 +61,7 @@
6161
"cell_type": "markdown",
6262
"metadata": {},
6363
"source": [
64-
"Let's say a mouse in the lab has a lab-specific ID but it also has a separate id issued by the animal facility."
64+
"Let's say a mouse in the lab has a lab-specific ID but it also has a separate id issued by the animal facility.\n"
6565
]
6666
},
6767
{
@@ -266,25 +266,25 @@
266266
"cell_type": "markdown",
267267
"metadata": {},
268268
"source": [
269-
"The indexed searches are much faster!"
269+
"The indexed searches are much faster!\n"
270270
]
271271
},
272272
{
273273
"cell_type": "markdown",
274274
"metadata": {},
275275
"source": [
276-
"To make searches faster on fields other than the primary key or a foreign key, you can add a secondary index explicitly. \n",
276+
"To make searches faster on fields other than the primary key or a foreign key, you can add a secondary index explicitly.\n",
277277
"\n",
278-
"Regular indexes are declared as `index(attr1, ..., attrN)` on a separate line anywhere in the table declration (below the primary key divide). \n",
278+
"Regular indexes are declared as `index(attr1, ..., attrN)` on a separate line anywhere in the table declration (below the primary key divide).\n",
279279
"\n",
280-
"Indexes can be declared with unique constraint as `unique index (attr1, ..., attrN)`."
280+
"Indexes can be declared with unique constraint as `unique index (attr1, ..., attrN)`.\n"
281281
]
282282
},
283283
{
284284
"cell_type": "markdown",
285285
"metadata": {},
286286
"source": [
287-
"Let's redeclare the table with a unique index on `tag_id`."
287+
"Let's redeclare the table with a unique index on `tag_id`.\n"
288288
]
289289
},
290290
{
@@ -430,7 +430,7 @@
430430
"cell_type": "markdown",
431431
"metadata": {},
432432
"source": [
433-
"Now both types of searches are equally efficient!"
433+
"Now both types of searches are equally efficient!\n"
434434
]
435435
},
436436
{
@@ -469,15 +469,15 @@
469469
"source": [
470470
"%%timeit -n6 -r3\n",
471471
"\n",
472-
"# efficient! Uses the seconary index on tag_id\n",
472+
"# efficient! Uses the secondary index on tag_id\n",
473473
"(Mouse2() & {\"tag_id\": random.randint(0, 999_999)}).fetch()"
474474
]
475475
},
476476
{
477477
"cell_type": "markdown",
478478
"metadata": {},
479479
"source": [
480-
"Let's now imagine that rats in the `Rat` table are identified by the combination of lab the `lab_name` and `rat_id` in each lab:"
480+
"Let's now imagine that rats in the `Rat` table are identified by the combination of lab the `lab_name` and `rat_id` in each lab:\n"
481481
]
482482
},
483483
{
@@ -656,14 +656,14 @@
656656
"cell_type": "markdown",
657657
"metadata": {},
658658
"source": [
659-
"Note that dispite the fact that `rat_id` is in the index, search by `rat_id` alone are not helped by the index because it is not first in the index. This is similar to search for a word in a dictionary that orders words alphabetically. Searching by the first letters of a word is easy but searching by the last few letters of a word requires scanning the whole dictionary."
659+
"Note that despite the fact that `rat_id` is in the index, search by `rat_id` alone are not helped by the index because it is not first in the index. This is similar to search for a word in a dictionary that orders words alphabetically. Searching by the first letters of a word is easy but searching by the last few letters of a word requires scanning the whole dictionary.\n"
660660
]
661661
},
662662
{
663663
"cell_type": "markdown",
664664
"metadata": {},
665665
"source": [
666-
"In this table, the primary key is a unique index on the combination `(lab_id, rat_id)`. Therefore searches on these attributes or on `lab_id` alone are fast. But this index cannot help searches on `rat_id` alone:"
666+
"In this table, the primary key is a unique index on the combination `(lab_id, rat_id)`. Therefore searches on these attributes or on `lab_id` alone are fast. But this index cannot help searches on `rat_id` alone:\n"
667667
]
668668
},
669669
{
@@ -730,7 +730,7 @@
730730
"cell_type": "markdown",
731731
"metadata": {},
732732
"source": [
733-
"Pattern searches in strings can benefit from an index when the starting characters are specified."
733+
"Pattern searches in strings can benefit from an index when the starting characters are specified.\n"
734734
]
735735
},
736736
{
@@ -777,7 +777,7 @@
777777
"cell_type": "markdown",
778778
"metadata": {},
779779
"source": [
780-
"Similarly, searching by the date requires an inefficient full-table scan:"
780+
"Similarly, searching by the date requires an inefficient full-table scan:\n"
781781
]
782782
},
783783
{
@@ -803,7 +803,7 @@
803803
"cell_type": "markdown",
804804
"metadata": {},
805805
"source": [
806-
"To speed up searches by the `rat_id` and `date_of_birth`, we can explicit indexes to `Rat`:"
806+
"To speed up searches by the `rat_id` and `date_of_birth`, we can explicit indexes to `Rat`:\n"
807807
]
808808
},
809809
{
@@ -878,7 +878,7 @@
878878
"cell_type": "markdown",
879879
"metadata": {},
880880
"source": [
881-
"#### Quiz: How many indexes does the table `Rat` have?"
881+
"#### Quiz: How many indexes does the table `Rat` have?\n"
882882
]
883883
},
884884
{
@@ -901,14 +901,14 @@
901901
"cell_type": "markdown",
902902
"metadata": {},
903903
"source": [
904-
"Three: primary key, rat_id, date_of_birth"
904+
"Three: primary key, rat_id, date_of_birth\n"
905905
]
906906
},
907907
{
908908
"cell_type": "markdown",
909909
"metadata": {},
910910
"source": [
911-
"# Indexes in SQL"
911+
"# Indexes in SQL\n"
912912
]
913913
},
914914
{

db-course/004-DatabaseSales.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
{
1919
"cell_type": "code",
20-
"execution_count": 2,
20+
"execution_count": null,
2121
"metadata": {},
2222
"outputs": [
2323
{
@@ -439,7 +439,7 @@
439439
"\n",
440440
"('S12_3891','1969 Ford Falcon','Classic Cars','1:12','Second Gear Diecast','Turnable front wheels; steering function; detailed interior; detailed engine; opening hood; opening trunk; opening doors; and detailed chassis.',1049,'83.05','173.02'),\n",
441441
"\n",
442-
"('S12_3990','1970 Plymouth Hemi Cuda','Classic Cars','1:12','Studio M Art Models','Very detailed 1970 Plymouth Cuda model in 1:12 scale. The Cuda is generally accepted as one of the fastest original muscle cars from the 1970s. This model is a reproduction of one of the orginal 652 cars built in 1970. Red color.',5663,'31.92','79.80'),\n",
442+
"('S12_3990','1970 Plymouth Hemi Cuda','Classic Cars','1:12','Studio M Art Models','Very detailed 1970 Plymouth Cuda model in 1:12 scale. The Cuda is generally accepted as one of the fastest original muscle cars from the 1970s. This model is a reproduction of one of the original 652 cars built in 1970. Red color.',5663,'31.92','79.80'),\n",
443443
"\n",
444444
"('S12_4473','1957 Chevy Pickup','Trucks and Buses','1:12','Exoto Designs','1:12 scale die-cast about 20\\\" long Hood opens, Rubber wheels',6125,'55.70','118.50'),\n",
445445
"\n",
@@ -517,7 +517,7 @@
517517
"\n",
518518
"('S18_4600','1940s Ford truck','Trucks and Buses','1:18','Motor City Art Classics','This 1940s Ford Pick-Up truck is re-created in 1:18 scale of original 1940s Ford truck. This antique style metal 1940s Ford Flatbed truck is all hand-assembled. This collectible 1940\\'s Pick-Up truck is painted in classic dark green color, and features rotating wheels.',3128,'84.76','121.08'),\n",
519519
"\n",
520-
"('S18_4668','1939 Cadillac Limousine','Vintage Cars','1:18','Studio M Art Models','Features completely detailed interior including Velvet flocked drapes,deluxe wood grain floor, and a wood grain casket with seperate chrome handles',6645,'23.14','50.31'),\n",
520+
"('S18_4668','1939 Cadillac Limousine','Vintage Cars','1:18','Studio M Art Models','Features completely detailed interior including Velvet flocked drapes,deluxe wood grain floor, and a wood grain casket with separate chrome handles',6645,'23.14','50.31'),\n",
521521
"\n",
522522
"('S18_4721','1957 Corvette Convertible','Classic Cars','1:18','Classic Metal Creations','1957 die cast Corvette Convertible in Roman Red with white sides and whitewall tires. 1:18 scale quality die-cast with detailed engine and underbvody. Now you can own The Classic Corvette.',1249,'69.93','148.80'),\n",
523523
"\n",
@@ -529,7 +529,7 @@
529529
"\n",
530530
"('S24_1578','1997 BMW R 1100 S','Motorcycles','1:24','Autoart Studio Design','Detailed scale replica with working suspension and constructed from over 70 parts',7003,'60.86','112.70'),\n",
531531
"\n",
532-
"('S24_1628','1966 Shelby Cobra 427 S/C','Classic Cars','1:24','Carousel DieCast Legends','This diecast model of the 1966 Shelby Cobra 427 S/C includes many authentic details and operating parts. The 1:24 scale model of this iconic lighweight sports car from the 1960s comes in silver and it\\'s own display case.',8197,'29.18','50.31'),\n",
532+
"('S24_1628','1966 Shelby Cobra 427 S/C','Classic Cars','1:24','Carousel DieCast Legends','This diecast model of the 1966 Shelby Cobra 427 S/C includes many authentic details and operating parts. The 1:24 scale model of this iconic lightweight sports car from the 1960s comes in silver and it\\'s own display case.',8197,'29.18','50.31'),\n",
533533
"\n",
534534
"('S24_1785','1928 British Royal Navy Airplane','Planes','1:24','Classic Metal Creations','Official logos and insignias',3627,'66.74','109.42'),\n",
535535
"\n",

db-course/004-DatabaseUniversity.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# Define"
7+
"# Define\n"
88
]
99
},
1010
{
@@ -1138,14 +1138,14 @@
11381138
"cell_type": "markdown",
11391139
"metadata": {},
11401140
"source": [
1141-
"# Queries"
1141+
"# Queries\n"
11421142
]
11431143
},
11441144
{
11451145
"cell_type": "markdown",
11461146
"metadata": {},
11471147
"source": [
1148-
"## Restriction"
1148+
"## Restriction\n"
11491149
]
11501150
},
11511151
{
@@ -1928,7 +1928,7 @@
19281928
"metadata": {},
19291929
"outputs": [],
19301930
"source": [
1931-
"# Millenials\n",
1931+
"# Millennials\n",
19321932
"millennials = Student & 'date_of_birth between \"1981-01-01\" and \"1996-12-31\"'"
19331933
]
19341934
},
@@ -2607,7 +2607,7 @@
26072607
}
26082608
],
26092609
"source": [
2610-
"# Millenials who have never enrolled\n",
2610+
"# Millennials who have never enrolled\n",
26112611
"millennials - Enroll"
26122612
]
26132613
},
@@ -3623,7 +3623,7 @@
36233623
"cell_type": "markdown",
36243624
"metadata": {},
36253625
"source": [
3626-
"## Join"
3626+
"## Join\n"
36273627
]
36283628
},
36293629
{
@@ -3690,7 +3690,7 @@
36903690
"cell_type": "markdown",
36913691
"metadata": {},
36923692
"source": [
3693-
"## Aggr"
3693+
"## Aggr\n"
36943694
]
36953695
},
36963696
{

0 commit comments

Comments
 (0)