Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

I am trying to follow the instructions

I am trying to follow the instructions and set up this DB environment variable in my nextjs app but I am stuck at the very first step.
No description

What are your thoughts of separate

What are your thoughts of separate databases? I have a users table in an auth database, but user-owned resources are in product-specific databases, making foreign key references impossible. 😦 Should I cave and put the tables in the same database so that I can have foreign keys on user IDs, or should I keep a separation of concerns to decrease the blast radius of a security incident?

hi all, i'm developing a worker that has

hi all, i'm developing a worker that has access to D1 databases through D1 database bindings (set as variables under D1 Database Bindings). how am i able to reach those databases when i'm developing locally? using queries like this: {results} = await env.IRADB.prepare(<here goes the query>).bind(<binds>).run();

Any recommendations for using d1 data

Any recommendations for using d1 data with an external analytics system like metabase?

Does `PRAGMA defer_foreign_keys=ON` not

Does PRAGMA defer_foreign_keys=ON not disable on update and on delete actions? Kinda weird when SQLite often requires recreating tables (and thus triggering those actions)

Yes, since those virtual tables reside

Yes, since those virtual tables reside in memory and require read operations. If you are on the free plan, you can’t be billed anything. If you are on the $5 paid plan, you will only be billed once you exceed 25 billion reads per month....

🤞 no data loss

🤞 no data loss

That seems like the current bookmark id

That seems like the current bookmark id - guessing it's disabled as it'd be a no-op

Also that you have to switch out the

Also that you have to switch out the configs manually

Or should I create an issue somewhere

Or should I create an issue somewhere else for this?

Alpha database migration guide · Cloudfl...

Hello , i am trying to perform an alpha database migration for one of my alpha databases , i followed this guide: https://developers.cloudflare.com/d1/platform/alpha-migration/#1-verify-that-a-database-is-alpha but i keep getting error Internal error: failed to run backup: Failed to query D1: D1 API returned: (500 Internal Server Error) {"error":"Error 9000: something went wrong","success":false} [code: 7500] when i run wrangler d1 backup command , any idea how to resolve this ?...

Can prepared statements bind arrays for `IN (?)`

does anyone know if prepared statements can be bound with arrays? i'm trying to do a query like db.prepare('SELECT * FROM table WHERE status IN (?)').bind(['active','expired']).all(), would that work?

Hey all, is something up with `wrangler

Hey all, is something up with wrangler d1 info + wrangler d1 insights? info is reporting 0 read queries in the past 24h (not the case unless it's somehow using some local version? The ID is the same as in my CF dash) insights is returning an empty array regardless of configuration...

Hello, I have had success with the D1 in

Hello, I have had success with the D1 in development all the way until production deployment. I have bound it using the updated syntax from docs (Pages). When i attempt to query when deployed, It crashes with Application Error. Works just fine in wrangler preview. AccountId: 77e1b1d919d86d253e4967517aab4437...

i'm getting `Error: D1_ERROR: D1 is

i'm getting Error: D1_ERROR: D1 is overloaded. Too many requests queued. for the last while. its a tiny little d1 database with no traffic

Are older d1 databases still 2gb? Mine

Are older d1 databases still 2gb? Mine just hit 2gb and stopped working

Load testing w/ weird results (1k req, 40s resp times)

Doing some load testing and getting weird results. Any recommendations to get the average response time down to something manageable so I can use D1 in the wild Doing simple query SELECT * FROM table_name WHERE updated_at >= ? AND name > ? ORDER BY updated_at ASC, name LIMIT 1000 - 100k row table, 17mb...

So I think I found a bug where simply

So I think I found a bug where simply looking at a D1 database in the dashboard causes a huge number of rows to be read. I have indexes for all of my queries and the high number of rows read is happening only when I pull up the database (simply looking at the table data).
No description

Importing a 13MB SQL File

Hi, I'm having trouble importing my database. I'm using `npx wrangler d1 execute --config packages/root/wrangler.toml --e production --remote --file "mydb.sql" mydb-prod-main While that works locally (with --local), it fails with a 504 Gateway timeout each time I try it... Any idea how to work around that? The .sql file is 13MB....
No description

only alpha dbs shouldn't have a usage

only alpha dbs shouldn't have a usage dashboard, what do you see?