Lakeday docs

Quickstart

Sign up, create an instance, make a token and write a table with the stock LanceDB SDK.

1. Sign up

Sign up at dashboard.lakeday.ai. The first sign-in asks you to name your workspace. A workspace, called an organization in the API, owns your instances, members, tokens and billing.

Your first ramp small instance is free for 30 days, with no card. See Billing for what happens after that.

2. Create an instance

On Instances, choose New instance. Give it a name, and keep the defaults: shape ramp and cache small. You can resize it later; see Instances.

The instance takes a minute or two to start. When it shows Running, open it. Its Connect section shows the database, db://<instance id>, and the endpoint, https://db.lakeday.ai, which every instance shares.

3. Make an access token

On the instance page, choose New token. Name it, tick the scopes it needs, and create it. For this walkthrough tick data:read and data:write.

The token is shown once. Copy it now and keep it somewhere safe; if you lose it, revoke it and make another.

export LAKEDAY_INSTANCE_ID="<instance id>"      # from the instance page
export LAKEDAY_TOKEN="<the token you just made>"

4. Connect with the LanceDB SDK

There is no Lakeday SDK. You use the stock LanceDB client, pointed at your instance.

The clients choose their transport from the URI. The URI names your instance as the database, db://<instance id>, and the endpoint goes in host_override (hostOverride in JavaScript). The endpoint routes each request to your instance by that database name.

Python:

pip install lancedb pyarrow
import os
import lancedb

db = lancedb.connect(
    "db://" + os.environ["LAKEDAY_INSTANCE_ID"],
    api_key=os.environ["LAKEDAY_TOKEN"],
    host_override="https://db.lakeday.ai",
)
table = db.create_table("clicks", data=[
    {"id": 1, "city": "ams", "value": 2.0},
    {"id": 2, "city": "ams", "value": 3.0},
    {"id": 3, "city": "ber", "value": 7.0},
])
print(table.count_rows())
print(table.search().where("city = 'ams'").limit(10).to_list())

JavaScript:

npm install @lancedb/lancedb
import * as lancedb from "@lancedb/lancedb";

const db = await lancedb.connect(`db://${process.env.LAKEDAY_INSTANCE_ID}`, {
  apiKey: process.env.LAKEDAY_TOKEN,
  hostOverride: "https://db.lakeday.ai",
});
const table = await db.createTable("clicks", [
  { id: 1, city: "ams", value: 2.0 },
  { id: 2, city: "ams", value: 3.0 },
  { id: 3, city: "ber", value: 7.0 },
]);
console.log(await table.countRows());
console.log(await table.query().where("city = 'ams'").limit(10).toArray());

Each write is durable in the instance’s object storage before the SDK gets its answer.

Next