title: Import data. COPY & INSERT in Cassandra
body: <p>I am trying to find out how different relational and NoSQL databases work in order to understand the performance behavior of this or that database. 
  So yesterday I created a database with PostgreSQL <a href="https://stackoverflow.com/questions/37074757/csv-file-data-into-a-postgresql-table/37076626#37076626">CSV file data into a PostgreSQL table</a>.</p>
  
  <p>The same example: Movielens (<a href="http://grouplens.org/datasets/movielens/" rel="nofollow noreferrer">http://grouplens.org/datasets/movielens/</a>). We've got movies and ratings. Movies have multiple genres. I splitted those out into a separate table since it's a 1:many relationship. There's a many:many relationship as well, users to movies. I need to be able to query this table multiple ways.</p>
  
  <p>Now I want to create the same databsase with Cassandra. I model my tables to be optimized to answer specific queries</p>
  
  <pre><code>CREATE TABLE movies (
      movie_id int primary key,
      title text,
      avg_rating decimal,
      total_ratings int,
      genres set&lt;text&gt;
  );
  
  # shows all movies for specific genre
  CREATE TABLE genre_to_movies (
      genre text,
      movie_id int,
      name text,
      primary key (genre, movie_id)
  );
  
  # show the number of movies of specific genre
  CREATE TABLE movies_per_genre (
      genre text primary key,
      movies int
  );
  
  # shows all ratings for specific movie
  CREATE TABLE ratings_by_movie (
      movie_id int,
      user_id int,
      rating decimal,
      ts int,
      primary key(movie_id, user_id)
  );
  
  # show all ratings of specific user
  CREATE TABLE ratings_by_user (
      user_id int,
      movie_id int,
      rating decimal,
      ts int,
      primary key(user_id, movie_id)
  );
  </code></pre>
  
  <p>I have 2 csv files:
  <strong>movies.csv</strong>: movie_id; movie_name; genre_name</p>
  
  <pre><code>1;Toy Story (1995);Animation|Children's|Comedy
  </code></pre>
  
  <p><strong>ratings.csv</strong>: user_id; movie_id; rating, timestamp</p>
  
  <pre><code>1;1193;5;978300760
  </code></pre>
  
  <p>What ist the best way to import data into my tables?
  For example, how can I import data to genres set from movies.csv? How can I split the string "Animation|Children's|Comedy"?
  If I do it manually:</p>
  
  <pre><code>INSERT INTO movies(movie_id,..., genre) VALUES ('Toy Story (1995)', ...,['Animation','Children's','Comedy'])
  </code></pre>
  
  <p>but how can I import this data for all movies?</p>
  
  <p><strong>Can you please show the best strategy for COPY &amp; INSERT commands using this example/database?</strong></p>