Greenplum Export CSV:修订间差异

来自牛奶河Wiki
跳到导航 跳到搜索
(创建页面,内容为“ ===Greenplum Export CSV=== m02, bi, ~/tmp/ PW=Bi...1123 FN=/tmp/test_cross.txt ====Greenplum Export CSV : Table==== SSQL="logs.l_serv_monitor" ====Greenplum Export CSV : SQL==== SSQL=`cat test_cross.sql` <small>''# test_cross.sql''</small> <small>''select   create_date,''</small> <small>''         platform,''</small> <small>''         operatingsystemversion,''</small> <small>''         channelid,''</small> <small>''         chan…”)
 
无编辑摘要
 
(未显示同一用户的1个中间版本)
第1行: 第1行:
Greenplum Export CSV


===Greenplum Export CSV===
=== Greenplum Export CSV ===
  m02, bi, ~/tmp/
  # m02, bi, ~/tmp/
  PW=Bi...1123
  PW=Bi...1123
  FN=/tmp/test_cross.txt
  FN=/tmp/test_cross.txt
====Greenplum Export CSV : Table====
====Table====
SSQL="logs.l_serv_monitor"
SSQL="logs.l_serv_monitor"


====Greenplum Export CSV : SQL====
====SQL====
SSQL=`cat test_cross.sql`
SSQL=`cat test_cross.sql`
 
<small>''# test_cross.sql''</small>
# test_cross.sql
 
select  create_date,
<small>''select   create_date,''</small>
          platform,
 
          operatingsystemversion,
<small>''         platform,''</small>
          channelid,
 
          channelname,
<small>''         operatingsystemversion,''</small>
          count(*) cs
 
from    ods.gio_ads_track_activation
<small>''         channelid,''</small>
where    1=1
 
and      date_hour_id like '202210%'
<small>''         channelname,''</small>
group by create_date,
 
          platform,
<small>''         count(*) cs''</small>
          operatingsystemversion,
 
          channelid,
<small>''from     ods.gio_ads_track_activation''</small>
          channelname
 
order by create_date,
<small>''where    1=1''</small>
          platform,
 
          operatingsystemversion,
<small>''and      date_hour_id like '202210%'''</small>
          channelid,
 
          channelname
<small>''group by create_date,''</small>
 
<small>''         platform,''</small>
 
<small>''         operatingsystemversion,''</small>
 
<small>''         channelid,''</small>
 
<small>''         channelname''</small>
 
<small>''order by create_date,''</small>
 
<small>''         platform,''</small>
 
<small>''         operatingsystemversion,''</small>
 
<small>''         channelid,''</small>
 
<small>''         channelname''</small>


=== Export ===
=== Export ===
PGPASSWORD=${PW} psql -U gpadmin -h 10.10.139.20 -d owgp -w -c "copy (${SSQL}) to STDOUT with (FORMAT csv, header true, encoding UTF8)" > ${FN}
PGPASSWORD=${PW} psql -U gpadmin -h 10.10.139.20 -d owgp -w -c "copy (${SSQL}) to STDOUT with (FORMAT csv, header true, encoding UTF8)" > ${FN}
 
=== test_cross.txt ===
2022-10-01,Android,Android 10,"","",1752
 
2022-10-01,Android,Android 10,a9BG6rRn,wap站跳转app,7
 
2022-10-01,Android,Android 10,baidufeeds,百度原生信息流,83


2022-10-01,Android,Android 10,huaweiads_app_ocpd,华为应用商店oCPD,1143
=== Res: test_cross.txt ===
2022-10-01,Android,Android 10,"","",1752
2022-10-01,Android,Android 10,a9BG6rRn,wap站跳转app,7
2022-10-01,Android,Android 10,baidufeeds,百度原生信息流,83
2022-10-01,Android,Android 10,huaweiads_app_ocpd,华为应用商店oCPD,1143




[[分类:Develop]]
[[分类:Develop]]
[[分类:DB]]
[[分类:DB]]
[[分类:Greenplum]]

2023年1月18日 (三) 22:45的最新版本

Greenplum Export CSV

Greenplum Export CSV

# m02, bi, ~/tmp/
PW=Bi...1123
FN=/tmp/test_cross.txt

Table

SSQL="logs.l_serv_monitor"

SQL

SSQL=`cat test_cross.sql`

# test_cross.sql
select   create_date,
         platform,
         operatingsystemversion,
         channelid,
         channelname,
         count(*) cs
from     ods.gio_ads_track_activation
where    1=1
and      date_hour_id like '202210%'
group by create_date,
         platform,
         operatingsystemversion,
         channelid,
         channelname
order by create_date,
         platform,
         operatingsystemversion,
         channelid,
         channelname

Export

PGPASSWORD=${PW} psql -U gpadmin -h 10.10.139.20 -d owgp -w -c "copy (${SSQL}) to STDOUT with (FORMAT csv, header true, encoding UTF8)" > ${FN}

Res: test_cross.txt

2022-10-01,Android,Android 10,"","",1752
2022-10-01,Android,Android 10,a9BG6rRn,wap站跳转app,7
2022-10-01,Android,Android 10,baidufeeds,百度原生信息流,83
2022-10-01,Android,Android 10,huaweiads_app_ocpd,华为应用商店oCPD,1143