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

improve batch insert #3287

Merged
merged 1 commit into from
Feb 19, 2025
Merged

improve batch insert #3287

merged 1 commit into from
Feb 19, 2025

Conversation

chitalian
Copy link
Contributor

No description provided.

Copy link

vercel bot commented Feb 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
helicone ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:36pm
helicone-bifrost ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:36pm
helicone-eu ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 6:36pm

Copy link
Contributor

promptless bot commented Feb 19, 2025

✅ No documentation updates required.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Enhanced batch insert functionality for improved database performance in input record creation and experiment management.

  • Added createInputRecords method in /valhalla/jawn/src/managers/inputs/InputsManager.ts for efficient bulk insertion using a single SQL query
  • Optimized /valhalla/jawn/src/managers/experiment/ExperimentV2Manager.ts to use batch operations instead of individual Promise.all calls
  • Implemented UUID generation and parameterized values for secure batch processing
  • Added organization-level validation checks for prompt versions in batch operations

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

return err(result.error);
}

return ok(inputRecordIds);
Copy link

Choose a reason for hiding this comment

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

logic: returning inputRecordIds without verifying successful insertion of all records. Should compare result.data.length with inputs.length

Suggested change
return ok(inputRecordIds);
if (result.data?.length !== inputs.length) {
return err('Not all records were inserted successfully');
}
return ok(inputRecordIds);

Copy link

fumedev bot commented Feb 19, 2025

Summary

  • Improved batch insertion of input records in ExperimentV2Manager by replacing a loop with a single method call to InputsManager.createInputRecords.
  • Added the createInputRecords method in InputsManager, which dynamically constructs and executes a batch INSERT SQL query.
  • The new method includes validation to ensure the prompt version exists before proceeding with the insert.
  • Utilizes UUIDs for identifying each input record, improving uniqueness and traceability.
⏳ 5 tests in progress

@chitalian chitalian merged commit 59b4c71 into main Feb 19, 2025
6 of 9 checks passed
@chitalian chitalian deleted the improve-batch-insert branch February 19, 2025 18:55
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.

1 participant