Amos
Amos
Explore posts from servers
DTDrizzle Team
Created by Amos on 3/5/2024 in #help
Using ATTACH with Drizzle
I want to use ATTACH with Drizzle so I can join between 2 dbs, is this currently possible? Something like this:
import { createClient } from "@libsql/client";

async function example() {
const db = createClient({
url: process.env.LIBSQL_URL,
authToken: process.env.LIBSQL_AUTH_TOKEN,
});
const txn = await db.transaction("read");
await txn.execute("ATTACH \"bc307076-d9fc-11ee-b5d4-f69bd26a54ba\" AS attached");
const rs = await txn.execute("SELECT * FROM attached.t");
console.log(rs);
txn.close();
}

await example();
import { createClient } from "@libsql/client";

async function example() {
const db = createClient({
url: process.env.LIBSQL_URL,
authToken: process.env.LIBSQL_AUTH_TOKEN,
});
const txn = await db.transaction("read");
await txn.execute("ATTACH \"bc307076-d9fc-11ee-b5d4-f69bd26a54ba\" AS attached");
const rs = await txn.execute("SELECT * FROM attached.t");
console.log(rs);
txn.close();
}

await example();
1 replies