drizzle-orm icon indicating copy to clipboard operation
drizzle-orm copied to clipboard

Feedback for “Aws Data API”

Open princejoogie opened this issue 2 years ago • 2 comments

How can i use this type of connection for drizzle studio and using drizzle-kit push

import { RDS } from "sst/node/rds";

const rdsClient = new RDSDataClient({
  region: "ap-southeast-1",
});

export const db = drizzle(rdsClient, {
  database: RDS.database.defaultDatabaseName,
  secretArn: RDS.database.secretArn,
  resourceArn: RDS.database.clusterArn,
  schema,
});

since in drizzle.config.ts, it requires a connections string which i can't directly get from my connection type with Aws Data API.

Context: I am using SST and created my RDS with SST as well with:

const rds = new RDS(stack, "database", {
  engine: "postgresql13.9",
  defaultDatabaseName: "dbname",
});

I'm already able to connect, and do crud on my db, also was able to do migrations but programatically:

import { migrate } from "drizzle-orm/aws-data-api/pg/migrator";
import { db } from "../connection";

const main = async () => {
  await migrate(db, { migrationsFolder: "drizzle" });
};

main().catch(console.error);

Is there any way I can use other drizzle-kit cli like studio, push, etc with AWS Data API?

princejoogie avatar Oct 05 '23 15:10 princejoogie

Any updates/progress here?

My DB is provisioned using SST ion/v3, which does not expose username/password or the components of connectionString

colemahatmccreary avatar Mar 28 '24 18:03 colemahatmccreary

This issue is still there in the latest version. There's no way to configure a region in drizzle config so we are unable to use any of the drizzle-kit commands. For example if we run drizzle-kit push we get the following error: Pulling schema from database...Error: Region is missing

poorya-smile avatar Aug 08 '24 17:08 poorya-smile

@princejoogie Hey! This should help: Drizzle with SST

RomanNabukhotnyi avatar Aug 26 '24 11:08 RomanNabukhotnyi