In this post,you will learn how to import MovieLens data to SQLite 3 using the SQLite standard import command.
Get MovieLens 20M dataset using http://grouplens.org/datasets/movielens/
Download and extract it.
It contains four csv files(links,ratings,movies,tags).
The ratings.csv file is bigger one(more than 500MB).
Create SQLite database using
Create table for ratings
create table ratings(userid text,movieid text,rating text,rate_time text)
The all columns created with text datatype,why because , the ratings csv file contains column name(text) as first row.
.separator "," .import ratings.csv to ratings
That’s all. You done. It took 30 seconds to import 500MB data. It depends upon your system speed.If your csv file is in different location ,please use exact file path.say for example,if your ratings file present in d drive
.import d:/ratings.csv to ratings
Now query the ratings tables
select * from ratings limit 10
You can import other csv files using the same above procedure.