-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
ISSUE-680 # Add the DB SQL Executor to import data from CSV and execute SQL statements #686
ISSUE-680 # Add the DB SQL Executor to import data from CSV and execute SQL statements #686
Conversation
@javiertuya , excellent work! Just checking:
|
Yes. The target DB is configured in
It would also be possible to run the postgres tests in the Github Actions (spin-up postgres takes around 6 seconds)
I just checked it: connecting from a desktop to a remote server in my lab (through a VPN) and it works fine. To check this, just run a postgress instance in the server, and form the desktop, change the |
@a1shadows , @omkar-shitole 👋 : |
Should we also try and create some documentation to https://github.com/authorjapps/zerocode-tdd-docs/tree/main? |
@a1shadows , But, please check if you want to add anything to it or amend it to make it more helpful, then please proceed 👍 |
I've tested against MySQL. To run the tests, it needs a few changes:
I can do the above changes in new commits in this PR or after review and merge, as you prefer. |
@javiertuya , I ran this against a Postgres DB. It didn't execute as expected. Can you have a look and fix it if possible? Looks like it is expecting a correct Driver. Note: I didn't create any tables yet, just wanted to see if the SQL gets executed or not. Docker PG brought up from here:
I ran this
Config:
Error:
Fix:Uncommenting this in the POM.xml started working.
Action:Can you keep the driver uncommented, and enable couple of (1 or 2 tests) for CI to run against PG DB? |
@authorjapps Done. A new commit (3ca2575) that:
|
We may not need this in
|
|
||
@TargetEnv("db_test.properties") | ||
@RunWith(ZeroCodeUnitRunner.class) | ||
public class DbSqlExecutorScenarioTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@javiertuya , looking great mate 👋
This is an integration test, which cover both with and without headers aspects 👍 .
Can you move this Test to this package please?
- zerocode/core/src/test/java/org/jsmart/zerocode/integrationtests
- Under this create a new package "db"
@authorjapps @nirmalchandra This PR is approved and merged 👋, but there is an unresolved comment: #686 (comment). |
@javiertuya , yes please, appreciate you spotted this. Thanks. Cheers |
Add the DB SQL Executor to import data from CSV and execute SQL statements
Fixes Issue
PR Branch
https://github.com/javiertuya/zerocode/tree/680-db-sql-executor
Documentation at PR authorjapps/zerocode-tdd-docs#24
Motivation and Context
This PR provides an out of the box component that uses the Java API to execute steps that interact with a database.
The executor class
org.jsmart.zerocode.core.db.DbSqlExecutor
provides two operations:EXECUTE
: Run a SQL statement to verify the data stored in the database or insert/update in the data.LOADCSV
: Load the contents of a CSV file located in the resources folder into a table.Acceptance critera fulfillment:
Suggestions for future improvements:
Checklist:
New Unit tests were added
Integration tests were added
Test names are meaningful
Feature manually tested and outcome is successful
PR doesn't break any of the earlier features for end users
Branch build passed in CI
No 'package.*' in the imports
Relevant DOcumentation page added or updated with clear instructions and examples for the end user
Http test added to
http-testing
module(if applicable) ?Kafka test added to
kafka-testing
module(if applicable) ?