From the course: Advanced NoSQL for Data Science

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Load data into Cassandra

Load data into Cassandra

- [Instructor] We're starting off where we left off in the last video. What I'd now like to do is load some data using json. So, the first thing I'm going to do is import a json library. Now, I'm going to use the with open command to open my json file, which is called companies.json, and I'm going to refer to that file as f_in for file input, and I'm going to use the json load command to read that file in. Now, I want to save the contents of the file into a variable, so I'm going to use the variable companies. Now, let's double check on the type of companies. It's a list, that's what I expected. So let's take a look at the first element in that list. Okay, it's got information about a company, as we'd expect. Now, that certainly looks like a dictionary, but just to make sure, I'm going to execute the type command on the first element and the companies list. Yup, it's a dictionary. Now, the next thing I want to do is execute a very simple insert statement to insert one company record…

Contents