Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.
/ cassandra-csv Public archive

Import data from a csv to Cassandra using Spark Sql

Notifications You must be signed in to change notification settings

agcorrea/cassandra-csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cassandra CSV

Simple utility java class to import data from a csv file directly to Cassandra using Spark SQL

Usage

ImportCsv.start(csc)
        // csv path
        .read("cassandra-csv/src/main/resources/example.csv")

        // csv structure
        .schema(schema)

        // options from spark-csv package. see https://github.com/databricks/spark-csv
        .option("header", "true")

        // select expression to be applied on csv data frame
        .selectExpr("id", "type AS transaction_type", "value")

        // keyspace and table name
        .saveToCassandra("my_keyspace", "my_table");

Based on package https://github.com/databricks/spark-csv.

About

Import data from a csv to Cassandra using Spark Sql

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages