This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* TD_SCHEDULED_TIME() = '2018-11-23 11:11:00' */ | |
/* | |
SELECT target_month, segment, COUNT(1) AS cnt | |
FROM | |
( | |
*/ | |
SELECT target_month, | |
CASE | |
WHEN 50<=ratio_freq_sleeping OR 50<=ratio_pv_sleeping THEN 'sleeping' | |
WHEN 50<=ratio_freq_morning OR 50<=ratio_pv_morning THEN 'morning' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TD_TIME_FORMAT(time,'u','JST') # 1(月曜日) 〜 7(日曜日) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TD_DATE_TRUNC('day',time,'JST') AS access_day |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WHERE TD_INTERVAL(time, '-10y/-1M', 'JST') /* 1ヶ月前より過去 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 基準日 = '2018-11-23 11:11:00' | |
[2018-11-22 00:00:00, 2018-11-23 00:00:00) # 日次 | |
[2018-11-12 00:00:00, 2018-11-19 00:00:00) # 週次 | |
[2018-10-01 00:00:00, 2018-11-01 00:00:00) # 月次 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM (VALUES (1, 'apple'), (2, 'banana')) as fruit(id, name); | |
# このクエリでは, 以下のデータセットがクエリ内で生成され使用されています。 | |
# id | name | |
#-----+-------- | |
# 1 | apple | |
# 2 | banana |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 元のクエリ | |
col1 < 100 OR col2 is TRUE AND TD_TIME_RANGE(time, '2015-11-01') | |
-- 上のクエリは AND が優先的に考慮されるため, 以下のクエリと同義になります。 | |
-- OR によって左右に分解されたこのクエリでは, TD_TIME_RANGE があるにも関わらず, (col1 < 100) の判定のために全件スキャンになります! | |
(col1 < 100) OR (col2 is TRUE AND TD_TIME_RANGE(time, '2015-11-01')) | |
-- クエリ全体に TIME_RANGE 制約を利かす場合は明示的に () を使いましょう! | |
-- 以下のクエリでは TIME_RANGE 制約内のデータセットで (col1 < 100 OR col2 is TRUE) が判定されます。 | |
(col1 < 100 OR col2 is TRUE) AND TD_TIME_RANGE(time, '2015-11-01') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM table1 | |
WHERE | |
col1 < 100 | |
OR col2 is TRUE | |
AND TD_TIME_RANGE(time, '2015-11-01') | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in: | |
type: google_analytics | |
json_key_content: | | |
{ | |
// from Google API Service Account's Private Key | |
"type": "service_account", | |
"project_id": "ga-to-td", | |
"private_key_id": "18f4c*****", | |
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgI*****", | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doryokujin :: ~/mydag » digdag run mydag.dig 1 ↵ | |
2017-01-10 10:38:06 +0900: Digdag v0.9.1 | |
2017-01-10 10:38:08 +0900 [WARN] (main): Using a new session time 2017-01-10T00:00:00+00:00. | |
2017-01-10 10:38:08 +0900 [INFO] (main): Using session /Users/doryokujin/mydag/.digdag/status/20170110T000000+0000. | |
2017-01-10 10:38:08 +0900 [INFO] (main): Starting a new session project id=1 workflow name=mydag session_time=2017-01-10T00:00:00+00:00 | |
2017-01-10 10:38:09 +0900 [INFO] (0018@+mydag+setup): echo>: start 2017-01-10T00:00:00+00:00 | |
start 2017-01-10T00:00:00+00:00 | |
2017-01-10 10:38:09 +0900 [INFO] (0018@+mydag+disp_current_date): echo>: 2017-01-10 00:00:00 +00:00 | |
2017-01-10 00:00:00 +00:00 | |
2017-01-10 10:38:09 +0900 [INFO] (0018@+mydag+repeat): for_each>: {order=[first, second, third], animal=[dog, cat]} |
NewerOlder