Skip to content

Instantly share code, notes, and snippets.

@mackjoner
Created December 20, 2019 09:33
Show Gist options
  • Save mackjoner/6819da54c58968b8fc8647aa3e13c654 to your computer and use it in GitHub Desktop.
Save mackjoner/6819da54c58968b8fc8647aa3e13c654 to your computer and use it in GitHub Desktop.
clickhouse
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "RENAME TABLE adn_monitor.adn_stat TO adn_monitor.adn_stat_old"
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "RENAME TABLE adn_monitor.adn_stat_tk TO adn_monitor.adn_stat_tk_old"
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "RENAME TABLE adx_monitor.adx_stat TO adx_monitor.adx_stat_old"
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "RENAME TABLE adx_monitor.adx_stat_tk TO adx_monitor.adx_stat_tk_old"
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "CREATE TABLE IF NOT EXISTS adn_monitor.adn_stat (yyyymmdd Int32, hh Int8, mm Int8, timestamp DateTime, publisherId Int64, appId Int64, unitId Int64, sdkVersion String, scenario String, algorithm String, adType String, countryCode String, requestType Int8, platform String, advertiserId Int64, campaignId Int64, advUserId Int64, advOfferId Int64, thirdParty String, creativeId Int64, advCreativeId Int64, advAdtype Int64, campaignPackageName String, finalSubid Int64, finalPackageName String, request UInt64, fillRequest UInt64, pv UInt64, impression UInt64, preImpression UInt64, preClick UInt64, click UInt64, advConversion Int64, lossImpression Int64, advImpression Int64, advClick Int64, vtaConversion UInt64, conversion UInt64, lossClick UInt64, rejectedConversion UInt64, cost Float64, revenue Float64, region String, thirdFillRequest UInt64, extReduceFillReq UInt64, extReduceFillResp UInt64, hasIdfa Int8, hasGaid Int8, extData String, extData2 String, extReject String) ENGINE = ReplacingMergeTree() PARTITION BY yyyymmdd ORDER BY timestamp TTL timestamp + toIntervalDay(15) SETTINGS index_granularity = 8192"
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "CREATE TABLE IF NOT EXISTS adn_monitor.adn_stat_tk (yyyymmdd Int32, hh Int8, mm Int8, timestamp DateTime, publisherId Int64, appId Int64, unitId Int64, sdkVersion String, scenario String, algorithm String, adType String, countryCode String, requestType Int8, platform String, advertiserId Int64, campaignId Int64, advUserId Int64, advOfferId Int64, thirdParty String, creativeId Int64, advCreativeId Int64, advAdtype Int64, campaignPackageName String, finalSubid Int64, finalPackageName String, request UInt64, fillRequest UInt64, pv UInt64, impression UInt64, preImpression UInt64, preClick UInt64, click UInt64, advConversion Int64, lossImpression Int64, advImpression Int64, advClick Int64, vtaConversion UInt64, conversion UInt64, lossClick UInt64, rejectedConversion UInt64, cost Float64, revenue Float64, region String, thirdFillRequest UInt64, extReduceFillReq UInt64, extReduceFillResp UInt64, hasIdfa Int8, hasGaid Int8, extData String, extData2 String, extReject String) ENGINE = ReplacingMergeTree() PARTITION BY yyyymmdd ORDER BY timestamp TTL timestamp + toIntervalDay(15) SETTINGS index_granularity = 8192"
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "CREATE TABLE IF NOT EXISTS adx_monitor.adx_stat (yyyymmdd Int32, hh Int8, mm Int8, timestamp DateTime, channel Int64, platform String, make String, model String, osVersion String, countryCode String, publisherId String, appId String, appVersion String, channelRequest Int32, spotId String, adType Int32, bidFloor Float64, dspId Int32, bitBidReason Int32, dspRequest Int32, dspFillRequest Int32, rejectCode Int32, bidPrice Float64, winPrice Float64, impression Int32, lossImpression Int32, click Int32, lossClick Int32) ENGINE = ReplacingMergeTree() PARTITION BY yyyymmdd ORDER BY timestamp TTL timestamp + toIntervalDay(15) SETTINGS index_granularity = 8192"
docker exec monitor-clickhouse-server-v4 /usr/bin/clickhouse-client -q "CREATE TABLE IF NOT EXISTS adx_monitor.adx_stat_tk (yyyymmdd Int32, hh Int8, mm Int8, timestamp DateTime, channel Int64, platform String, make String, model String, osVersion String, countryCode String, publisherId String, appId String, appVersion String, channelRequest Int32, spotId String, adType Int32, bidFloor Float64, dspId Int32, bitBidReason Int32, dspRequest Int32, dspFillRequest Int32, rejectCode Int32, bidPrice Float64, winPrice Float64, impression Int32, lossImpression Int32, click Int32, lossClick Int32) ENGINE = ReplacingMergeTree() PARTITION BY yyyymmdd ORDER BY timestamp TTL timestamp + toIntervalDay(15) SETTINGS index_granularity = 8192"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment