1. In Funnel

Create a file export in Funnel to the destination of your choice:

  • S3

  • Microsoft Blob Storage

  • Google Cloud Storage

  • SFTP

Export your files as CSV or TSV.

Depending on your setup you might need to have another step to move the files to where you host your Cassandra instance.

2. In Cassandra

This is an example of a setup in Cassandra, if you already have a complete setup then the step 2.4 is enough.

2.1 Create a keyspace

Create a keyspace named "example" with two nodes

CREATE KEYSPACE example WITH replication = {
'class': 'SimpleStrategy', 'replication_factor': 2
};

2.2 Use the keyspace

Use the keyspace created in the previous step

USE example;

2.3 Create a table

Create a table named "example" with two nodes

CREATE TABLE IF NOT EXISTS funnel_data (
date date PRIMARY KEY,
sourceType text,
sourceId text,
currency text,
common_cost float,
common_clicks int,
common_impressions int
);

2.4 Copy the data into the table

The file exported to s3 in step 1 can now be copied into the table.

With a simple COPY FROM statement you can copy the csv or tsv file into the table.

Important: Remember to use the ESCAPE='"' option since we use quotes as escape characters.

COPY funnel_data (
date,
sourceType,
sourceId,
currency,
common_cost,
common_clicks,
common_impressions
)
FROM 'example.csv'
WITH ESCAPE='"';'

Done!

Your data is now stored and can be queried in your Cassandra database.

Did this answer your question?