Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Copy From CSV - COLUMN FAMILY NOT FOUND

I've spent the past two days checking the available answers on this site and a few other sites. I need help with the following (COPY FROM a CSV file) issue I'm encountering. I created the KEYSPACE and COLUMN FAMILY without any issues, but I receive a COLUMN FAMILY NOT FOUND when I attempt to copy a CSV file into the Table/Column Family. I've included the syntax I'm using below. I would truly appreciate help with resolving this matter. (Cassandra 2.0.6, CQL3.1.1)

I'm new to CQLSH.

CREATE KEYSPACE KS_TERA
  WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 3 };

CREATE COLUMNFAMILY TERA
         (BIT_ID int PRIMARY KEY,
    YEAR int ,  
    DAY_OF_MONTH int ,
    BIT_DATE timestamp ,
    COMP_ID int ,
    CARRIER varchar ,
    CARRIER_NUM int ,
    ORIGIN_SHIP_ID int 
         )
          WITH COMPACT STORAGE;

COPY TERA FROM ‘TERA.CSV’  WITH DELIMITER = ‘,’ AND HEADER = FALSE;

I get a COLUMN FAMILY NOT FOUND error.

like image 956
Cary Avatar asked Oct 21 '22 11:10

Cary


1 Answers

That's because COPY command is case sensitive, you must replace the name of table (column family) and its columns in your command like this:

COPY tera FROM ‘TERA.CSV’  WITH DELIMITER = ‘,’ AND HEADER = FALSE;

if you have columns, then like this:

COPY tera (column1, column2, ... , columnn) FROM ‘TERA.CSV’  WITH DELIMITER = ‘,’ AND HEADER = FALSE;

Hope it helps to someone now...

like image 82
jcflorezr Avatar answered Oct 30 '22 13:10

jcflorezr