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.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With