foundry-rs / foundry-rs/foundry
feat(`cheatcodes`): support direct database connections for test pipelines (Postgres, MySQL, etc..)
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 18h 20m
- Merged PRs (30d)
- 510
Description
### Component
Forge
### Describe the feature you would like
**Description:**
I would like to request the addition of direct database connection support to take advantage for test pipelines. As numerous pipelines already utilize staging and development databases effectively, extending this capability to forge would be highly beneficial.
**My Use Case:**
I am currently running simulations that require access to extensive datasets hosted on a Postgres database. At present, my workaround involves exporting the required data as CSV files, writing a custom wrapper for these files, and utilizing filesystem cheat-code commands to feed the data into my simulations. This process is both time-consuming and cumbersome.
**Proposed Feature:**
The feature would enable direct database connections from forge test contracts, allowing users to:
1. Establish connections to various databases (e.g., Postgres, MySQL, etc.).
2. Execute queries directly to fetch the necessary data.
3. Insert or update test results back into the database.
**Benefits:**
1. Enhanced Efficiency: Direct data access will significantly speed up test and simulation iterations.
2. Improved Data Management: Simplifies data handling, ensuring better consistency and reliability.
**Request for Feedback:**
I would appreciate the community's insights and thoughts on this potential feature. How do others currently handle large dataset access for their tests? Are there existing solutions or workarounds that the community finds effective?
Thank you for considering this feature request.
Best regards,
Shahverdi
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.