kittu
kittu

Reputation: 7008

Cassandra copy-from more than 100 columns

I was going through cassandra-docs in how to use copy-from and copy-to commands to get the data in to the cluster.

Example from docs:

COPY airplanes (name, manufacturer, year, mach) FROM 'temp.csv';

where I have to mention the column names in the parenthesis. what if I have more than 100 columns? I can't keep entering the column names which is tedious task. Is there any other way to achieve this.

Also what are the other sources from where I can load the data ex: excel, other db or xml file etc.

Upvotes: 0

Views: 666

Answers (1)

Cedric H.
Cedric H.

Reputation: 8298

It is not a Cassandra problem but a user-friendly feature of cqlsh which lets you import data from a few file formats. If you want something fancier, write your own Python script (that's just what cqlsh is doing).

From Datastax Academy:

Note: copy does not require columns name when the target table schema and source CSV file columns match respectively.

COPY videos FROM 'videos.csv';

Upvotes: 2

Related Questions