1import * as GCP from "@/GCP";
2import * as Output from "@/Output";
3import * as Effect from "effect/Effect";
4
5/**
6 * A BigQuery table Feature Groups can register as their source: one row
7 * per `entity_id` with an `age` feature column.
8 */
9export const UsersSource = Effect.gen(function* () {
10 const dataset = yield* GCP.BigQuery.Dataset("FeatureSource", {
11 location: "US-CENTRAL1",
12 forceDestroy: true,
13 });
14 const table = yield* GCP.BigQuery.Table("FeatureSourceTable", {
15 datasetId: dataset.datasetId,
16 schema: [
17 { name: "entity_id", type: "STRING", mode: "REQUIRED" },
18 { name: "age", type: "INTEGER" },
19 { name: "feature_timestamp", type: "TIMESTAMP" },
20 ],
21 });
22 return Output.interpolate`bq://${table.project}.${table.datasetId}.${table.tableId}`;
23});