From the course: Code Clinic: Clojure

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Populating the DB

Populating the DB - Clojure Tutorial

From the course: Code Clinic: Clojure

Start my 1-month free trial

Populating the DB

- [Instructor] In this video we'll request data from Link Pinned and record it in the database. We'll start by defining a function called record data for year bang. Give this a year parameter, and I'll create a let binding. First I'll bind last d t to a call to d b find last datetime. We'll use this value to track our last recorded time in the database so that we only record values after that. Next, I'll create a binding I'll call data seek by calling fetch seek for year, and I'll pass for the given year. This will be the sequence of data coming from let pend in the let body, I'll create doseq expression because we'll need to iterate over this sequence and perform some side effects. Rather than iterating over the entire sequence at once, I'm gonna call the built in partition all function and pass it the value 1000 and then pass it to data seq. This will create a sequence of sequences of size 1000 or less. In this way we'll group the response in rows of 1000. So I'll bind this to row…

Contents