Domanda

I am attempting to copy a csv file in a Cassandra table using

so in cqlsh, something like:

COPY mytable FROM 'test.csv' WITH header=TRUE;

problem is that in practice, my CSV file has more than a hundred columns. Is it necessary to define each column using

CREATE TABLE mytable (<all my columns here>);

or hopefully, is there some way to create the table f rom the column headers? I mean, I could write a short python script that reads the column headers and then outputs them into a format i can just copy and paste into , but I'm wondering if there's a more elegant way?

Thanks Alex

È stato utile?

Soluzione

No, there is no way to create a table from CSV in CQLSH. Unfortunately CSV doesn't contain information about columns' types, so CQLSH can't figure that out to create a table.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top