-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mysql results table commands and add tests (#49)
Closes #48. * fix: mysql results table commands and add tests * fix: update CI workflow to include mysql tests --------- Co-authored-by: Lakshay Kalbhor <[email protected]>
- Loading branch information
Showing
6 changed files
with
128 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[app] | ||
log_level = "DEBUG" | ||
default_job_ttl = "60s" | ||
|
||
[job_queue.broker] | ||
type = "redis" | ||
addresses = ["localhost:6379"] | ||
password = "" | ||
db = 1 | ||
max_active = 50 | ||
max_idle = 20 | ||
dial_timeout = "1s" | ||
read_timeout = "1s" | ||
write_timeout = "1s" | ||
|
||
[job_queue.state] | ||
type = "redis" | ||
addresses = ["localhost:6379"] | ||
password = "" | ||
db = 1 | ||
max_active = 50 | ||
max_idle = 20 | ||
dial_timeout = "1s" | ||
read_timeout = "1s" | ||
write_timeout = "1s" | ||
expiry = "30s" | ||
meta_expiry = "3600s" | ||
|
||
# Results database configuration (MySQL) | ||
[results.my_results] | ||
type = "mysql" | ||
dsn = "root:rootpassword@tcp(127.0.0.1:3306)/mydb" | ||
max_idle = 10 | ||
max_active = 100 | ||
connect_timeout = "10s" | ||
results_table = "results_%s" | ||
|
||
[db.my_db] | ||
type = "mysql" | ||
dsn = "root:rootpassword@tcp(127.0.0.1:3306)/mydb" | ||
max_idle = 10 | ||
max_active = 100 | ||
connect_timeout = "10s" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-- test.sql | ||
-- concurrency parameter is associated with the queue. | ||
-- Once a queue is set to a particular concurrency, it cannot be changed. | ||
-- In the below example both `get_profit_summary` and `get_profit_entries` use | ||
-- a common queue with concurrency = 5. It is okay to pass concurrency | ||
-- again in `get_profit_entries` as long as it is the same as the one defined initially (5) | ||
|
||
-- name: get_profit_summary | ||
-- db: my_db | ||
-- concurrency: 5 | ||
-- queue: test | ||
SELECT SUM(amount) AS total, entry_date FROM entries WHERE user_id = ? GROUP BY entry_date; | ||
|
||
-- name: get_profit_entries | ||
-- db: my_db | ||
-- queue: test | ||
SELECT * FROM entries WHERE user_id = ?; | ||
|
||
-- name: get_profit_entries_by_date | ||
-- queue: test | ||
SELECT * FROM entries WHERE user_id = ? AND timestamp > ? and timestamp < ?; | ||
|
||
-- name: slow_query | ||
-- db: my_db | ||
-- queue: test | ||
SELECT SLEEP(?); |
File renamed without changes.