Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: D1 execute and backup commands improvements #2107

Merged
merged 4 commits into from
Nov 2, 2022

Conversation

celso
Copy link
Contributor

@celso celso commented Oct 31, 2022

  • Better and faster handling when importing big SQL files using execute --file
  • Increased visibility during imports, sends output with each batch API call
  • Backups are now downloaded to the directory where wrangler was initiated from

- Better and faster handling when importing big SQL files using execute --file
- Increased visibility during imports, sends output with each batch API call
- Backups are now downloaded to the directory where wrangler was initiated from
@changeset-bot
Copy link

changeset-bot bot commented Oct 31, 2022

🦋 Changeset detected

Latest commit: f31091d

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 31, 2022

A wrangler prerelease is available for testing. You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/3363610522/npm-package-wrangler-2107

You can reference the automatically updated head of this PR with:

npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/2107/npm-package-wrangler-2107

Or you can use npx with this latest build directly:

npx https://prerelease-registry.developers.workers.dev/runs/3363610522/npm-package-wrangler-2107 dev path/to/script.js
Additional artifacts:
npm install https://prerelease-registry.developers.workers.dev/runs/3363610522/npm-package-cloudflare-pages-shared-2107

@codecov
Copy link

codecov bot commented Oct 31, 2022

Codecov Report

Merging #2107 (f31091d) into main (2a81cae) will decrease coverage by 0.05%.
The diff coverage is 6.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2107      +/-   ##
==========================================
- Coverage   73.11%   73.05%   -0.06%     
==========================================
  Files         127      127              
  Lines        8610     8618       +8     
  Branches     2264     2265       +1     
==========================================
+ Hits         6295     6296       +1     
- Misses       2315     2322       +7     
Impacted Files Coverage Δ
packages/wrangler/src/d1/execute.tsx 14.87% <3.70%> (-1.65%) ⬇️
packages/wrangler/src/d1/backups.tsx 26.92% <16.66%> (+0.60%) ⬆️
...ackages/wrangler/src/__tests__/helpers/mock-bin.ts 100.00% <0.00%> (+5.26%) ⬆️

@@ -52,7 +51,7 @@ type QueryResult = {
query?: string;
};
// Max number of bytes to send in a single /execute call
const QUERY_LIMIT = 1_000_000; // 1MB
const QUERY_LIMIT = 10_000;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the benefit in sending 10kb over 1MB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

QUERY_LIMIT is actually the number of SQL statements going into a single D1 API request inside a transaction, not MB. 10,000 is a reasonable number that's efficient/fast enough when importing big SQL files, but also doesn't kill D1's DO from resource exhaustion.

@cloudflare cloudflare deleted a comment Nov 1, 2022
@JacobMGEvans JacobMGEvans merged commit 511943e into cloudflare:main Nov 2, 2022
@github-actions github-actions bot mentioned this pull request Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants