Skip to content

Commit d8203ec

Browse files
committed
Add week 5 assignments
1 parent d4332a8 commit d8203ec

File tree

6 files changed

+28
-12
lines changed

6 files changed

+28
-12
lines changed

_quarto.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ website:
3131
- modules/week04/hw-04-1.qmd
3232
- modules/week04/hw-04-2.qmd
3333
- modules/week04/hw-04-3.qmd
34-
#- modules/week05/hw-05-1.qmd
35-
#- modules/week05/hw-05-2.qmd
36-
#- modules/week05/hw-05-3.qmd
37-
#- modules/week05/hw-05-4.qmd
34+
- modules/week05/hw-05-1.qmd
35+
- modules/week05/hw-05-2.qmd
36+
- modules/week05/hw-05-3.qmd
37+
- modules/week05/hw-05-4.qmd
3838
#- modules/week06/hw-06-1.qmd
3939
#- modules/week06/hw-06-2.qmd
4040
#- modules/week06/hw-06-3.qmd

modules/week05/bash-essentials.qmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,13 @@ Other times you don't:
167167

168168
```
169169
query="SELECT * FROM table"
170-
sqlite3 db "$query"
170+
sqlite3 database.sqlite "$query"
171171
```
172172

173173
gets expanded to
174174

175175
```
176-
sqlite3 db "SELECT * FROM table"
176+
sqlite3 database.sqlite "SELECT * FROM table"
177177
```
178178

179179
If `$query` is not quoted in the previous example, `SELECT`, `*`, etc., will be passed as separate arguments, which is not what `sqlite3` expects. Making matters worse, `*` will then be interpreted as a wildcard and expanded into a list of all files in the current directory!
@@ -393,13 +393,13 @@ And two tips.
393393

394394
## Test your understanding
395395

396-
**Be sure to `cd` to the class data GitHub repository, week3 subdirectory, before answering these.**
396+
**Be sure to `cd` to the class data GitHub repository, `ASDN_csv` subdirectory, before answering these!!**
397397

398398
1. Compare the output of these three commands:
399399

400400
`ls`\
401401
`ls .`\
402-
`ls "$(pwd)/../week3"`
402+
`ls "$(pwd)/../ASDN_csv"`
403403

404404
Explain why you see what you see.
405405

@@ -424,7 +424,7 @@ And two tips.
424424

425425
`echo "$name_Howard"`
426426

427-
but that doesn't quite work. What fix can you apply to `$name` to make this command give the desired effect?
427+
but that doesn't quite work. What fix can you apply to `$name`, while keeping it inside the quotation marks, to make this command give the desired effect?
428428

429429
5. You create a script and run it like so:
430430

modules/week05/hw-05-1.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
title: "Week 5 - Protect yourself"
33
---
44

5+
**Please use Canvas to return the assignments: <https://ucsb.instructure.com/courses/26293/assignments/360504>**
6+
57
Some strategies were mentioned in class for reducing the possibility of performing UPDATEs and DELETEs that have catastrophic consequences. What strategy will you use?
8+
9+
**Credit: 5 points**

modules/week05/hw-05-2.qmd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
title: "Week 5 - Create a trigger"
33
---
44

5-
**For this assignment and this assignment only, you *must* use SQLite and [week5/database.sqlite](https://github.com/UCSB-Library-Research-Data-Services/bren-meds213-spring-2024-class-data/tree/main/week5) in the class data GitHub repository!**
5+
**Please use Canvas to return the assignments: <https://ucsb.instructure.com/courses/26293/assignments/360505>**
66

7-
(The SQLite command is `sqlite3`. It's already installed on taylor. Installing it on your local machine, if you like, is similar to installing DuckDB.)
7+
**For this assignment and this assignment only, you *must* use SQLite and [database.sqlite](https://github.com/UCSB-Library-Research-Data-Services/bren-eds213-data/blob/main/database/database.sqlite) in the class data GitHub repository!**
8+
9+
(The SQLite command is `sqlite3`. It's already installed on the Bren servers. Installing it on your local machine, if you like, is similar to installing DuckDB.)
810

911
The Bird_eggs table uniquely identifies each egg by a pair (Nest_ID, Egg_num). The egg numbers for a given nest always have the sequential values 1, 2, 3, 4, etc. For example, there are 3 eggs in nest 14eabaage01:
1012

@@ -150,3 +152,5 @@ INSERT INTO Bird_eggs
150152
```
151153

152154
Well you can do that! It involves creating a view and adding an INSTEAD OF INSERT trigger on the view. If there's time I'll show an example in class.
155+
156+
**Credit: 65 points**

modules/week05/hw-05-3.qmd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
title: "Week 5 - Bash essentials"
33
---
44

5-
Read [Ten Bash Essentials](bash-essentials.qmd) and answer the 8 questions at the end. Be sure you are in the [week3 directory](https://github.com/UCSB-Library-Research-Data-Services/bren-meds213-spring-2024-class-data/tree/main/week3) of the class data GitHub repository before answering the questions, as they rely on the files contained therein.
5+
**Please use Canvas to return the assignments: <https://ucsb.instructure.com/courses/26293/assignments/360506>**
6+
7+
Read [Ten Bash Essentials](bash-essentials.qmd) and answer the 8 questions at the end. Be sure you are in the [ASDN_csv](https://github.com/UCSB-Library-Research-Data-Services/bren-eds213-data/tree/main/ASDN_csv) of the class data GitHub repository before answering the questions, as they rely on the files contained therein.
8+
9+
**Credit: 20 points**

modules/week05/hw-05-4.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
title: "Week 5 - Create a test harness"
33
---
44

5+
**Please use Canvas to return the assignments: <https://ucsb.instructure.com/courses/26293/assignments/360508>**
6+
57
# Part 1
68

79
A common task is to create a script --- a "test harness" --- that will allow you to test something (some code, an algorithm, a model, etc.) by running it repeatedly, perhaps under varying conditions. Example applications include machine learning using different hyperparameters and Monte Carlo simulation using different random seeds. In this assignment you will create a Bash script that will allow you to time how long it takes to run an SQL query. You will be using this script later in class to explore the performance effects of indexes, so hang on to it.
@@ -130,3 +132,5 @@ SELECT DISTINCT Species FROM Bird_nests;
130132
```
131133

132134
Use your test harness to time these three queries. Use descriptive labels to record which query is being run, e.g., `subquery`, `outer_join`, and `except`. Submit your CSV file. Report back how many repetitions you had to use to get good timings, and which method is fastest.
135+
136+
**Credit: 50 points**

0 commit comments

Comments
 (0)