File tree 2 files changed +38
-23
lines changed
staging_queries/quickstart 2 files changed +38
-23
lines changed Original file line number Diff line number Diff line change 15
15
from ai .chronon .api .ttypes import Source , EventSource
16
16
from ai .chronon .query import Query , select
17
17
from ai .chronon .group_by import GroupBy , Aggregation , Operation
18
- from ai .chronon .api .ttypes import StagingQuery , MetaData
19
18
20
19
"""
21
20
This GroupBy aggregates metrics about a user's previous purchases in various windows.
68
67
),
69
68
],
70
69
)
71
-
72
-
73
- query = """
74
- SELECT
75
- ts,
76
- ds,
77
- purchase_id,
78
- user_id,
79
- product_id,
80
- purchase_price
81
- FROM data.purchases
82
- WHERE ds BETWEEN '{{ start_date }}' AND '{{ end_date }}'
83
- """
84
-
85
- staging_query = StagingQuery (
86
- query = query ,
87
- startPartition = "2023-10-31" ,
88
- metaData = MetaData (
89
- name = 'purchases_staging_query' ,
90
- outputNamespace = "data"
91
- )
92
- )
Original file line number Diff line number Diff line change
1
+ # Copyright (C) 2023 The Chronon Authors.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from ai .chronon .api .ttypes import StagingQuery , MetaData
16
+
17
+
18
+
19
+ query = """
20
+ SELECT
21
+ ts,
22
+ ds,
23
+ purchase_id,
24
+ user_id,
25
+ product_id,
26
+ purchase_price
27
+ FROM data.purchases
28
+ WHERE ds BETWEEN '{{ start_date }}' AND '{{ end_date }}'
29
+ """
30
+
31
+ staging_query = StagingQuery (
32
+ query = query ,
33
+ startPartition = "2023-10-31" ,
34
+ metaData = MetaData (
35
+ name = 'purchases_staging_query' ,
36
+ outputNamespace = "data"
37
+ )
38
+ )
You can’t perform that action at this time.
0 commit comments