Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/content/docs/d1/worker-api/d1-database.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ You can use the `bind` method to dynamically bind a value into the query statem
<Tabs syncKey="workersExamples"> <TabItem label="JavaScript" icon="seti:javascript">
```js
const stmt = db
.prepare("SELECT * FROM Customers WHERE CompanyName = Alfreds Futterkiste AND CustomerId = 1")
.prepare("SELECT * FROM Customers WHERE CompanyName = 'Alfreds Futterkiste' AND CustomerId = 1")
```
</TabItem> <TabItem label="Python" icon="seti:python">
```py
stmt = db.prepare("SELECT * FROM Customers WHERE CompanyName = Alfreds Futterkiste AND CustomerId = 1")
stmt = db.prepare("SELECT * FROM Customers WHERE CompanyName = 'Alfreds Futterkiste' AND CustomerId = 1")
```
</TabItem> </Tabs>

Expand Down Expand Up @@ -327,7 +327,7 @@ Dumps the entire D1 database to an SQLite compatible file inside an ArrayBuffer.

<Tabs syncKey="workersExamples"> <TabItem label="JavaScript" icon="seti:javascript">
```js
const dump = await db.dump();
const dump = await env.DB.dump();
return new Response(dump, {
status: 200,
headers: {
Expand All @@ -339,7 +339,7 @@ return new Response(dump, {
```py
from workers import Response

dump = await db.dump()
dump = await self.env.DB.dump()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this is correct since it is not inside a class in this snippet.

We should probably remove all the alpha (v1) methods from the docs altogether since this (dump()) no longer works to production D1 databases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vy-ton are you happy for us to drop this? Or should we keep it but mark it as a separate header?

If it's not supported, I'm in favour of removing it entirely

return Response(dump, status=200, headers={"Content-Type": "application/octet-stream"})
```
</TabItem> </Tabs>
Expand Down Expand Up @@ -404,7 +404,8 @@ const session = env.DB.withSession("first-primary");
const result = await session
.prepare(`SELECT * FROM Customers WHERE CompanyName = 'Bs Beverages'`)
.run()
return { bookmark } = session.getBookmark();
const bookmark = session.getBookmark();
return bookmark;
```
</TabItem> <TabItem label="Python" icon="seti:python">
```py
Expand Down