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

Passing SQL Query to DB middleware #83

Closed
andrea-dintino opened this issue Feb 1, 2022 · 3 comments · Fixed by #163
Closed

Passing SQL Query to DB middleware #83

andrea-dintino opened this issue Feb 1, 2022 · 3 comments · Fixed by #163
Assignees
Labels
enhancement New feature or request

Comments

@andrea-dintino
Copy link
Member

Two statements in the DB-mw like:

Given I have a database uri named 'myDb1'
Given I have a database table named 'myTable'
Given I execute the query 'myQuery1' on the database 'myDb1' and save the result into 'myZenroomStringDictionary'
Given I have a 'string dictionary' named 'myZenroomStringDictionary'
When I create the random object of '128' bits
Then I execute the query 'myQuery2' on the database 'myDb1' with the data 'random_object'

Queries (they are randomly selected sample queries):

myQuery1: 
  SELECT *
  FROM call
  ORDER BY
      call.employee_id ASC,
      call.start_time ASC;

myQuery2: 
  SELECT *
  FROM call
  ORDER BY
      call.employee_id ASC,
      call.start_time ASC;
@andrea-dintino andrea-dintino added the enhancement New feature or request label Feb 1, 2022
@puria
Copy link
Member

puria commented Feb 1, 2022

Duplicate of #51

@puria puria marked this as a duplicate of #51 Feb 1, 2022
@puria
Copy link
Member

puria commented Feb 1, 2022

Rememeber that in JSON we don't have the newlines to the query would be in form of

{
  "myQuery": "SELECT *\n  FROM call\n ORDER BY\n      call.employee_id ASC,\n      call.start_time ASC;"
}

or simply without them ;p

{
  "myQuery": "SELECT * FROM call ORDER BY call.employee_id ASC, call.start_time ASC;"
}

@andrea-dintino
Copy link
Member Author

andrea-dintino commented Feb 1, 2022

Yes we can do that, but we can also use YAML?
But the version with no newlines is fine too :-)

puria added a commit that referenced this issue May 17, 2022
@puria puria mentioned this issue May 17, 2022
Merged
puria added a commit that referenced this issue May 17, 2022
* feat(db): Allow execute multiple SQL queries onBefore
* Update tests

Closes #83, Fixes #51, Closes #46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants