forked from feast-dev/feast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeastFeatureViews.ts
More file actions
64 lines (59 loc) · 2.1 KB
/
Copy pathfeastFeatureViews.ts
File metadata and controls
64 lines (59 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import { z } from "zod";
import { FEAST_FEATURE_VALUE_TYPES } from "./types";
const FeastFeatureColumnSchema = z.object({
name: z.string(),
valueType: z.nativeEnum(FEAST_FEATURE_VALUE_TYPES),
tags: z.record(z.string()).optional(),
});
const FeastBatchSourceSchema = z.object({
type: z.string(),
eventTimestampColumn: z.string().optional(),
createdTimestampColumn: z.string().optional(),
fileOptions: z.object({
uri: z.string().optional(),
}).optional(),
name: z.string().optional(),
description: z.string().optional(),
owner: z.string().optional(),
meta: z.object({
earliestEventTimestamp: z.string().transform((val) => new Date(val)),
latestEventTimestamp: z.string().transform((val) => new Date(val)),
}).optional(),
requestDataOptions: z.object({
schema: z.record(z.nativeEnum(FEAST_FEATURE_VALUE_TYPES)),
}).optional(),
bigqueryOptions: z.object({
tableRef: z.string().optional(),
dbtModelSerialized: z.string().optional()
}).optional(),
dataSourceClassType: z.string(),
});
const FeastFeatureViewSchema = z.object({
spec: z.object({
description: z.string().optional(),
name: z.string(),
entities: z.array(z.string()),
features: z.array(FeastFeatureColumnSchema),
ttl: z.string().transform((val) => parseInt(val)),
batchSource: FeastBatchSourceSchema,
online: z.boolean().optional(),
owner: z.string().optional(),
tags: z.record(z.string()).optional(),
}),
meta: z.object({
createdTimestamp: z.string().transform((val) => new Date(val)).optional(),
lastUpdatedTimestamp: z.string().transform((val) => new Date(val)).optional(),
materializationIntervals: z
.array(
z.object({
startTime: z.string().transform((val) => new Date(val)),
endTime: z.string().transform((val) => new Date(val)),
})
)
.optional(),
}),
});
type FeastFeatureViewType = z.infer<typeof FeastFeatureViewSchema>;
type FeastFeatureColumnType = z.infer<typeof FeastFeatureColumnSchema>;
export { FeastFeatureViewSchema, FeastFeatureColumnSchema };
export type { FeastFeatureViewType, FeastFeatureColumnType };