---
title: Database
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/python)

[D1](https://developers.cloudflare.com/api/python/resources/d1)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Database

##### [List D1 Databases](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/list)

d1.database.list(DatabaseListParams\*\*kwargs) -> SyncV4PagePaginationArray\[[DatabaseListResponse](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)>)]

GET/accounts/{account\_id}/d1/database

##### [Get D1 Database](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/get)

d1.database.get(strdatabase\_id, DatabaseGetParams\*\*kwargs) -> [D1](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>)

GET/accounts/{account\_id}/d1/database/{database\_id}

##### [Create D1 Database](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/create)

d1.database.create(DatabaseCreateParams\*\*kwargs) -> [D1](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>)

POST/accounts/{account\_id}/d1/database

##### [Update D1 Database](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/update)

d1.database.update(strdatabase\_id, DatabaseUpdateParams\*\*kwargs) -> [D1](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>)

PUT/accounts/{account\_id}/d1/database/{database\_id}

##### [Update D1 Database partially](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/edit)

d1.database.edit(strdatabase\_id, DatabaseEditParams\*\*kwargs) -> [D1](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1%20%3E%20(model)%20d1%20%3E%20(schema)>)

PATCH/accounts/{account\_id}/d1/database/{database\_id}

##### [Delete D1 Database](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/delete)

d1.database.delete(strdatabase\_id, DatabaseDeleteParams\*\*kwargs) -> object

DELETE/accounts/{account\_id}/d1/database/{database\_id}

##### [Query D1 Database](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/query)

d1.database.query(strdatabase\_id, DatabaseQueryParams\*\*kwargs) -> SyncSinglePage\[[QueryResult](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)>)]

POST/accounts/{account\_id}/d1/database/{database\_id}/query

##### [Raw D1 Database query](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/raw)

d1.database.raw(strdatabase\_id, DatabaseRawParams\*\*kwargs) -> SyncSinglePage\[[DatabaseRawResponse](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)>)]

POST/accounts/{account\_id}/d1/database/{database\_id}/raw

##### [Export D1 Database as SQL](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/export)

d1.database.export(strdatabase\_id, DatabaseExportParams\*\*kwargs) -> [DatabaseExportResponse](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/d1/database/{database\_id}/export

##### [Import SQL into your D1 Database](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/methods/import)

d1.database.import\_(strdatabase\_id, DatabaseImportParams\*\*kwargs) -> [DatabaseImportResponse](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/d1/database/{database\_id}/import

##### ModelsExpand Collapse

<details>

<summary>

class QueryResult: …

</summary>

<details>

<summary>

meta: Optional\[Meta]

</summary>

changed\_db: Optional\[bool]

Denotes if the database has been altered in some way, like deleting rows.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changed_db">Link to this property</a>

changes: Optional\[float]

Rough indication of how many rows were modified by the query, as provided by SQLite’s <code>sqlite3_total_changes()</code>.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changes">Link to this property</a>

duration: Optional\[float]

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20duration">Link to this property</a>

last\_row\_id: Optional\[float]

The row ID of the last inserted row in a table with an <code>INTEGER PRIMARY KEY</code> as provided by SQLite. Tables created with <code>WITHOUT ROWID</code> do not populate this.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20last_row_id">Link to this property</a>

rows\_read: Optional\[float]

Number of rows read during the SQL query execution, including indices (not all rows are necessarily returned).

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_read">Link to this property</a>

rows\_written: Optional\[float]

Number of rows written during the SQL query execution, including indices.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_written">Link to this property</a>

served\_by\_colo: Optional\[str]

The three letters airport code of the colo that handled the query.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_colo">Link to this property</a>

served\_by\_primary: Optional\[bool]

Denotes if the query has been handled by the database primary instance.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_primary">Link to this property</a>

<details>

<summary>

served\_by\_region: Optional\[Literal\["WNAM", "ENAM", "WEUR", 3 more]]

Region location hint of the database instance that handled the query.

</summary>

One of the following:

"WNAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%200">Link to this property</a>

"ENAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%201">Link to this property</a>

"WEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%202">Link to this property</a>

"EEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%203">Link to this property</a>

"APAC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%204">Link to this property</a>

"OC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region">Link to this property</a>

size\_after: Optional\[float]

Size of the database after the query committed, in bytes.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20size_after">Link to this property</a>

<details>

<summary>

timings: Optional\[MetaTimings]

Various durations for the query.

</summary>

sql\_duration\_ms: Optional\[float]

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings%20%3E%20(property)%20sql_duration_ms">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20meta">Link to this property</a>

results: Optional\[List\[object]]

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20results">Link to this property</a>

success: Optional\[bool]

<a href="#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20query_result%20%3E%20(schema)>)

<details>

<summary>

class DatabaseListResponse: …

</summary>

created\_at: Optional\[datetime]

Specifies the timestamp the resource was created as an ISO8601 string.

formatdate-time

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

<details>

<summary>

jurisdiction: Optional\[Literal\["eu", "fedramp", "us"]]

Specify the location to restrict the D1 database to run and store data. If this option is present, the location hint is ignored.

</summary>

One of the following:

"eu"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%200">Link to this property</a>

"fedramp"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%201">Link to this property</a>

"us"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20jurisdiction">Link to this property</a>

name: Optional\[str]

D1 database name.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

uuid: Optional\[str]

D1 database identifier (UUID).

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20uuid">Link to this property</a>

version: Optional\[str]

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)%20%3E%20(property)%20version">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_list_response%20%3E%20(schema)>)

<details>

<summary>

class DatabaseRawResponse: …

</summary>

<details>

<summary>

meta: Optional\[Meta]

</summary>

changed\_db: Optional\[bool]

Denotes if the database has been altered in some way, like deleting rows.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changed_db">Link to this property</a>

changes: Optional\[float]

Rough indication of how many rows were modified by the query, as provided by SQLite’s <code>sqlite3_total_changes()</code>.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20changes">Link to this property</a>

duration: Optional\[float]

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20duration">Link to this property</a>

last\_row\_id: Optional\[float]

The row ID of the last inserted row in a table with an <code>INTEGER PRIMARY KEY</code> as provided by SQLite. Tables created with <code>WITHOUT ROWID</code> do not populate this.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20last_row_id">Link to this property</a>

rows\_read: Optional\[float]

Number of rows read during the SQL query execution, including indices (not all rows are necessarily returned).

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_read">Link to this property</a>

rows\_written: Optional\[float]

Number of rows written during the SQL query execution, including indices.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20rows_written">Link to this property</a>

served\_by\_colo: Optional\[str]

The three letters airport code of the colo that handled the query.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_colo">Link to this property</a>

served\_by\_primary: Optional\[bool]

Denotes if the query has been handled by the database primary instance.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_primary">Link to this property</a>

<details>

<summary>

served\_by\_region: Optional\[Literal\["WNAM", "ENAM", "WEUR", 3 more]]

Region location hint of the database instance that handled the query.

</summary>

One of the following:

"WNAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%200">Link to this property</a>

"ENAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%201">Link to this property</a>

"WEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%202">Link to this property</a>

"EEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%203">Link to this property</a>

"APAC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%204">Link to this property</a>

"OC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region">Link to this property</a>

size\_after: Optional\[float]

Size of the database after the query committed, in bytes.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20size_after">Link to this property</a>

<details>

<summary>

timings: Optional\[MetaTimings]

Various durations for the query.

</summary>

sql\_duration\_ms: Optional\[float]

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings%20%3E%20(property)%20sql_duration_ms">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta%20%3E%20(property)%20timings">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20meta">Link to this property</a>

<details>

<summary>

results: Optional\[Results]

</summary>

columns: Optional\[List\[str]]

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20columns">Link to this property</a>

<details>

<summary>

rows: Optional\[List\[List\[Union\[float, str, object]]]]

</summary>

One of the following:

float

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows%20%3E%20(items)%20%3E%20(items)%20%3E%20(variant)%200">Link to this property</a>

str

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows%20%3E%20(items)%20%3E%20(items)%20%3E%20(variant)%201">Link to this property</a>

object

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows%20%3E%20(items)%20%3E%20(items)%20%3E%20(variant)%202">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results%20%3E%20(property)%20rows">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20results">Link to this property</a>

success: Optional\[bool]

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_raw_response%20%3E%20(schema)>)

<details>

<summary>

class DatabaseExportResponse: …

</summary>

at\_bookmark: Optional\[str]

The current time-travel bookmark for your D1, used to poll for updates. Will not change for the duration of the export task.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20at_bookmark">Link to this property</a>

error: Optional\[str]

Only present when status = ‘error’. Contains the error message.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20error">Link to this property</a>

messages: Optional\[List\[str]]

Logs since the last time you polled

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20messages">Link to this property</a>

<details>

<summary>

result: Optional\[Result]

Only present when status = ‘complete’

</summary>

filename: Optional\[str]

The generated SQL filename.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20filename">Link to this property</a>

signed\_url: Optional\[str]

The URL to download the exported SQL. Available for one hour.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20signed_url">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20result">Link to this property</a>

<details>

<summary>

status: Optional\[Literal\["complete", "error"]]

</summary>

One of the following:

"complete"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"error"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

success: Optional\[bool]

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

type: Optional\[Literal\["export"]]

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)%20%3E%20(property)%20type">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_export_response%20%3E%20(schema)>)

<details>

<summary>

class DatabaseImportResponse: …

</summary>

at\_bookmark: Optional\[str]

The current time-travel bookmark for your D1, used to poll for updates. Will not change for the duration of the import. Only returned if an import process is currently running or recently finished.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20at_bookmark">Link to this property</a>

error: Optional\[str]

Only present when status = ‘error’. Contains the error message that prevented the import from succeeding.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20error">Link to this property</a>

filename: Optional\[str]

Derived from the database ID and etag, to use in avoiding repeated uploads. Only returned when for the ‘init’ action.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20filename">Link to this property</a>

messages: Optional\[List\[str]]

Logs since the last time you polled

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20messages">Link to this property</a>

<details>

<summary>

result: Optional\[Result]

Only present when status = ‘complete’

</summary>

final\_bookmark: Optional\[str]

The time-travel bookmark if you need restore your D1 to directly after the import succeeded.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20final_bookmark">Link to this property</a>

<details>

<summary>

meta: Optional\[ResultMeta]

</summary>

changed\_db: Optional\[bool]

Denotes if the database has been altered in some way, like deleting rows.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20changed_db">Link to this property</a>

changes: Optional\[float]

Rough indication of how many rows were modified by the query, as provided by SQLite’s <code>sqlite3_total_changes()</code>.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20changes">Link to this property</a>

duration: Optional\[float]

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20duration">Link to this property</a>

last\_row\_id: Optional\[float]

The row ID of the last inserted row in a table with an <code>INTEGER PRIMARY KEY</code> as provided by SQLite. Tables created with <code>WITHOUT ROWID</code> do not populate this.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20last_row_id">Link to this property</a>

rows\_read: Optional\[float]

Number of rows read during the SQL query execution, including indices (not all rows are necessarily returned).

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20rows_read">Link to this property</a>

rows\_written: Optional\[float]

Number of rows written during the SQL query execution, including indices.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20rows_written">Link to this property</a>

served\_by\_colo: Optional\[str]

The three letters airport code of the colo that handled the query.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_colo">Link to this property</a>

served\_by\_primary: Optional\[bool]

Denotes if the query has been handled by the database primary instance.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_primary">Link to this property</a>

<details>

<summary>

served\_by\_region: Optional\[Literal\["WNAM", "ENAM", "WEUR", 3 more]]

Region location hint of the database instance that handled the query.

</summary>

One of the following:

"WNAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%200">Link to this property</a>

"ENAM"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%201">Link to this property</a>

"WEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%202">Link to this property</a>

"EEUR"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%203">Link to this property</a>

"APAC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%204">Link to this property</a>

"OC"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region%20%3E%20(member)%205">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20served_by_region">Link to this property</a>

size\_after: Optional\[float]

Size of the database after the query committed, in bytes.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20size_after">Link to this property</a>

<details>

<summary>

timings: Optional\[ResultMetaTimings]

Various durations for the query.

</summary>

sql\_duration\_ms: Optional\[float]

The duration of the SQL query execution inside the database. Does not include any network communication.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20timings%20%3E%20(property)%20sql_duration_ms">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta%20%3E%20(property)%20timings">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20meta">Link to this property</a>

num\_queries: Optional\[float]

The total number of queries that were executed during the import.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result%20%3E%20(property)%20num_queries">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20result">Link to this property</a>

<details>

<summary>

status: Optional\[Literal\["complete", "error"]]

</summary>

One of the following:

"complete"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%200">Link to this property</a>

"error"

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20status%20%3E%20(member)%201">Link to this property</a>

</details>

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20status">Link to this property</a>

success: Optional\[bool]

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20success">Link to this property</a>

type: Optional\[Literal\["import"]]

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20type">Link to this property</a>

upload\_url: Optional\[str]

The R2 presigned URL to use for uploading. Only returned when for the ‘init’ action.

<a href="#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)%20%3E%20(property)%20upload_url">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database%20%3E%20(model)%20database_import_response%20%3E%20(schema)>)

#### DatabaseTime Travel

##### [Get D1 database bookmark](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/subresources/time_travel/methods/get_bookmark)

d1.database.time\_travel.get\_bookmark(strdatabase\_id, TimeTravelGetBookmarkParams\*\*kwargs) -> [TimeTravelGetBookmarkResponse](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_get_bookmark_response%20%3E%20(schema)>)

GET/accounts/{account\_id}/d1/database/{database\_id}/time\_travel/bookmark

##### [Restore D1 Database to a bookmark or point in time](https://developers.cloudflare.com/api/python/resources/d1/subresources/database/subresources/time_travel/methods/restore)

d1.database.time\_travel.restore(strdatabase\_id, TimeTravelRestoreParams\*\*kwargs) -> [TimeTravelRestoreResponse](<https://developers.cloudflare.com/api/python/resources/d1#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)>)

POST/accounts/{account\_id}/d1/database/{database\_id}/time\_travel/restore

##### ModelsExpand Collapse

<details>

<summary>

class TimeTravelGetBookmarkResponse: …

</summary>

bookmark: Optional\[str]

A bookmark representing a specific state of the database at a specific point in time.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_get_bookmark_response%20%3E%20(schema)%20%3E%20(property)%20bookmark">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_get_bookmark_response%20%3E%20(schema)>)

<details>

<summary>

class TimeTravelRestoreResponse: …

Response from a time travel restore operation.

</summary>

bookmark: Optional\[str]

The new bookmark representing the state of the database after the restore operation.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)%20%3E%20(property)%20bookmark">Link to this property</a>

message: Optional\[str]

A message describing the result of the restore operation.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)%20%3E%20(property)%20message">Link to this property</a>

previous\_bookmark: Optional\[str]

The bookmark representing the state of the database before the restore operation. Can be used to undo the restore if needed.

<a href="#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)%20%3E%20(property)%20previous_bookmark">Link to this property</a>

</details>

[Link to this property](<#(resource)%20d1.database.time_travel%20%3E%20(model)%20time_travel_restore_response%20%3E%20(schema)>)