將csv檔案匯入Cassandra裡面的表

2021-10-05 00:10:44 字數 1199 閱讀 7541

1、建立keyspace–retail_db

cqlsh>create keyspace retail_db with replication=

;

2、根據csv檔案的字段數量及型別建立相應的表

;3、通過copy命令匯入資料,可以根據需要選定匯入哪些字段,不一定要全部匯入

from:csv的存放路徑

delimiter:通過檢視csv檔案,字段通過』,『分割

quote:欄位的資料使用』 " 『包起來,為了防止資料中有』,'造成分割錯誤

header:沒有標頭檔案,第一行就是需要的資料

cqlsh:retail_db> 

copy customers(

customer_id,

customer_city,

customer_email,

customer_fname,

customer_lname,

customer_password,

customer_state,

customer_street,

customer_zipcode)

from '/opt/retail_db/customers.csv'

with delimiter=

',' and quote=

'"' and header=false;

將csv檔案匯入MySQL中

建立資料表 匯入csv格式檔案,首先保證表存在 create table nizong 1e data user id varchar 255 character set utf8mb4 collate utf8mb4 general ci null default null,age varchar...

如何將csv檔案匯入MySQL

root debian mysqlimport uroot p123456 fields terminated by fields enclosed by fields escaped by database name var lib mysql files table name.csv引數說明 f...

將csv檔案匯入到mysql

首先,為自己要匯入的檔案按照屬性建立好錶 mysql create table id int notnull primary key,name char 30 character set utf8 not null level char 30 character set utf8 not null,...