Export cassandra query result to a csv file

后端 未结 13 1859
刺人心
刺人心 2020-12-08 06:18

I\'m new in cassandra, and I have to export the result of a specific query to a csv file.

I found the COPY command, but (from what I understand) it allo

13条回答
  •  攒了一身酷
    2020-12-08 07:03

    In 2020th you can use DSBulk to export or import data to/from CSV (by default), or JSON. It could be as simple as:

    dsbulk unload -k keyspace -t table -u user -p password -url filename
    

    DSBulk is heavily optimized for fast data export, without putting too much load onto the coordinator node that happens when you just run select * from table.

    You can control what columns to export, and even provide your own query, etc. See following blog posts for examples:

    • https://www.datastax.com/blog/2019/03/datastax-bulk-loader-introduction-and-loading
    • https://www.datastax.com/blog/2019/04/datastax-bulk-loader-more-loading
    • https://www.datastax.com/blog/2019/04/datastax-bulk-loader-common-settings
    • https://www.datastax.com/blog/2019/06/datastax-bulk-loader-unloading
    • https://www.datastax.com/blog/2019/07/datastax-bulk-loader-counting
    • https://www.datastax.com/blog/2019/12/datastax-bulk-loader-examples-loading-other-locations

提交回复
热议问题