Thank you! Then I think I'm beginning to understand the limitations and differences between DO SQLit
Thank you! Then I think I'm beginning to understand the limitations and differences between DO SQLite and D1 better 
By the end of 2024, D1 will support automatic read replication for scalability and low-latency access around the world. If this managed model appeals to you, use D1.
UNION ALL SELECT terms. According to SQLite documentation, the number of terms in the query is limited by the value SQLITE_MAX_COMPOUND_SELECT which defaults to 500. But in D1 this is set to 5 and any query with more than 5 terms (like for inserting multiple values at once) fail with too many terms in compound SELECT. D1_ERROR: Network connection lost. errors being thrown since friday. Any idea if this is on d1 or my side?
.sqlite file not found in ${basePath});Error ${err});D1_ERROR: D1 DB storage operation exceeded timeout which caused object to be reset.
d1 info option, but this only returns EEUR.UNION ALL SELECTSQLITE_MAX_COMPOUND_SELECTtoo many terms in compound SELECTD1_ERROR: Network connection lost..sqlite file not found in ${basePath}Error ${err}D1_ERROR: D1 DB storage operation exceeded timeout which caused object to be reset.D1_ERROR: Internal error while starting up D1 DB storage caused object to be reset.6559cf5b-ea94-4b57-8f05-2228dc0075ead1 infoselect * from table where timestamp > ? order by timestamp descimport { defineConfig, type Config } from "drizzle-kit";
import { parse as parseJsonc } from "comment-json";
import { existsSync, readFileSync } from "fs";
import { join } from "path";
const wranglerConfig = parseJsonc(
readFileSync(join(__dirname, "wrangler.jsonc"), "utf-8"),
) as unknown as WranglerConfig;
const d1Config = wranglerConfig.d1_databases[0];
const env = Object.fromEntries(
((filePath) =>
existsSync(filePath)
? readFileSync(filePath, "utf-8")
.split("\n")
.filter((line) => line.trim() && !line.startsWith("#"))
.map((line) =>
line
.split(/=(.+)/)
.filter(Boolean)
.map((part) => part.trim()),
)
.filter((parts) => parts.length === 2)
.map(([key, value]) => [key, value?.replace(/^["']|["']$/g, "")])
: [])(join(process.cwd(), ".dev.vars")),
) as Record<string, string>;
/*
* NOTE: Workaround to make drizzle studio work with D1.
* https://kevinkipp.com/blog/going-full-stack-on-astro-with-cloudflare-d1-and-drizzle/
* Github discussion: https://github.com/drizzle-team/drizzle-orm/discussions/1545#discussioncomment-8115423
*/
export default process.env["NODE_ENV"] === "production"
? defineConfig({
dialect: "sqlite",
driver: "d1-http",
out: "drizzle",
schema: "src/db/schema.ts",
dbCredentials: {
accountId: env["CF_ACCOUNT_ID"]!,
token: env["CF_D1_TOKEN"]!,
databaseId: d1Config!.database_id!,
},
} satisfies Config)
: defineConfig({
dialect: "sqlite",
out: "drizzle",
schema: "src/db/schema.ts",
dbCredentials: {
url: env["DB_LOCAL_PATH"]!,
},
} satisfies Config);