当前位置:   article > 正文

MapD的数据导出与扩容(利用现有的表)

mapd 库

1.新建一个.csv的文件。

①打开目录mapd-core下的insert_sample_data,最下面有这句话:copy $table from '${csv}' with (quoted='true');

②在运行insert_sample_data后,下载的文件被放在了/mapd-core/build/sample_datasets,

打开/mapd-core/build/sample_datasets/flights_2008_10k中的flights_2008_10k.sql。

可以看到生成table的代码:

drop table if exists flights_2008_10k;

create table flights_2008_10k ( flight_year smallint, flight_month smallint, flight_dayofmonth smallint, flight_dayofweek smallint, deptime smallint, crsdeptime smallint, arrtime smallint, crsarrtime smallint, uniquecarrier text encoding dict, flightnum smallint, tailnum text encoding dict, actualelapsedtime smallint, crselapsedtime smallint, airtime smallint, arrdelay smallint, depdelay smallint, origin text encoding dict, dest text encoding dict, distance smallint, taxiin smallint, taxiout smallint, cancelled smallint, cancellationcode text encoding dict, diverted smallint, carrierdelay smallint, weatherdelay smallint, nasdelay smallint, securitydelay smallint, lateaircraftdelay smallint, dep_timestamp timestamp(0), arr_timestamp timestamp(0), carrier_name text encoding dict, plane_type text encoding dict, plane_manufacturer text encoding dict, plane_issue_date date, plane_model text encoding dict, plane_status text encoding dict, plane_aircraft_type text encoding dict, plane_engine_type text encoding dict, plane_year smallint, origin_name text encoding dict, origin_city text encoding dict, origin_state text encoding dict, origin_country text encoding dict, origin_lat real, origin_lon real, dest_name text encoding dict, dest_city text encoding dict, dest_state text encoding dict, dest_country text encoding dict, dest_lat real, dest_lon real, origin_merc_x real, origin_merc_y real, dest_merc_x real, dest_merc_y real ) with (fragment_size = 2000000);

以上可以看出所给表的结构。

③该文件夹中有包含10k数据的.csv。

④把表格拷出来:在/mapd-core/build/sample_datasets中mkdir flights_2008_new。 然后拷出来 cp flights_2008_10k.csv /mapd-core/build/sample_datasets/flights_2008_new 。改名:mv flights_2008_10k.csv flights_2008_new.csv

⑤在mapdql中,\timing计时。 COPY (SELECT * FROM flights_2008_10k) TO '/mapd-core/build/sample_datasets/flights_2008_new/flights_2008_new.csv';

2。在mapdql中建表flights_2008_test。

copy flights_2008_test from '/mapd-core/build/sample_datasets/flights_2008_new/flights_2008_new.csv' with (quoted='true');

重复以上的过程可以一直扩容。

如果需要大的数据库,可以用所给的7M数据库扩:

copy flights_2008_test from '/mapd-core/build/sample_datasets/flights_2008_7M/flights_2008_7M.csv' with (quoted='true');

转载于:https://www.cnblogs.com/laozhuang/p/7084255.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/一键难忘520/article/detail/741879
推荐阅读
相关标签
  

闽ICP备14008679号