Skip to content

GCP.BigLake reference

Source: packages/gcp/src/BigLake/Catalog.ts

A BigLake Metastore catalog — the top-level container for Hive databases and tables.

Catalogs have no labels, description, or annotations, and Alchemy does not write ownership into the catalog IAM policy: generated ids carry an alc_ prefix that list / nuke match, and read reports an explicit id it has no state for as unowned. Location and catalog id are immutable. There is nothing else to update in place.

Generated id

const catalog = yield* GCP.BigLake.Catalog("Lake", {});

Named catalog in a multi-region

const catalog = yield* GCP.BigLake.Catalog("Lake", {
catalogId: "analytics",
location: "US",
});

Source: packages/gcp/src/BigLake/CatalogsDatabase.ts

A Hive database inside a BigLake Metastore catalog.

Databases have no labels field — Alchemy stamps ownership into hiveOptions.parameters so list / nuke can find them. Catalog, database id, and type are immutable. Hive location URI and parameters update in place.

Hive database on a GCS prefix

const catalog = yield* GCP.BigLake.Catalog("Lake", {});
const database = yield* GCP.BigLake.CatalogsDatabase("Warehouse", {
catalog: catalog.name,
locationUri: `gs://${bucket.bucketName}/warehouse`,
parameters: { owner: "analytics" },
});

Named database

const database = yield* GCP.BigLake.CatalogsDatabase("Warehouse", {
catalog: catalog.name,
databaseId: "sales",
type: "HIVE",
hiveOptions: {
locationUri: "gs://my-bucket/sales",
},
});

CatalogsDatabase: Looking up an existing catalogs database

Section titled “CatalogsDatabase: Looking up an existing catalogs database”

CatalogsDatabase.lookup references a catalogs database Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared catalogs database.

const catalogsDatabase = GCP.BigLake.CatalogsDatabase.lookup({
databaseId: "my-database",
catalog: "my-catalog",
});

Source: packages/gcp/src/BigLake/CatalogsDatabasesTable.ts

A Hive table inside a BigLake Metastore database.

Tables have no labels field — Alchemy stamps ownership into hiveOptions.parameters so list / nuke can find them. Database, table id, and type are immutable. Hive options update in place.

Managed Hive table

const table = yield* GCP.BigLake.CatalogsDatabasesTable("Events", {
database: database.name,
hiveOptions: {
tableType: "MANAGED_TABLE",
storageDescriptor: {
locationUri: `gs://${bucket.bucketName}/events`,
inputFormat: "org.apache.hadoop.mapred.SequenceFileInputFormat",
outputFormat:
"org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat",
},
parameters: { owner: "analytics" },
},
});

Named external table

const table = yield* GCP.BigLake.CatalogsDatabasesTable("Events", {
database: database.name,
tableId: "page_views",
hiveOptions: {
tableType: "EXTERNAL_TABLE",
storageDescriptor: {
locationUri: "gs://my-bucket/page_views",
},
},
});

CatalogsDatabasesTable: Looking up an existing catalogs databases table

Section titled “CatalogsDatabasesTable: Looking up an existing catalogs databases table”

CatalogsDatabasesTable.lookup references a catalogs databases table Alchemy doesn’t manage (created in the console or by another stack). It is read during plan/deploy, never created, updated or deleted, and binds like a declared catalogs databases table.

const catalogsDatabasesTable = GCP.BigLake.CatalogsDatabasesTable.lookup({
tableId: "my-table",
database: "my-database",
});