Add support for orderBy in multiple tables
See original GitHub issueorderBy as written compares every orderBy
against every table in the expected data set. If the orderBy
column doesn’t exist in one of the provided tables it will NPE.
For example:
# expected.yml
foo:
- id: 1
- id: 2
bar:
- uuid: "uuid'3e6a4f38-f9b3-4697-bf9c-f9e957af2fdb'"
@ExpectedDataSet(value = "expected.yml", orderBy = "id")
The implementation of orderBy
is critically flawed. Which tables should orderBy
apply to? Should users be forced to supply one file per table and each array index mapped to an orderBy
index? In that case, how would you handle ordering multiple columns for multiple tables?
DbUnit had DatabaseAssertionMode.NON_STRICT_UNORDERED
which worked exactly as expected: it compares records without respect to ordering. Can’t we please just have that? 😭
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
SQL - Order By Sum of Multiple Tables Sharing Common ...
I would like to sum the revenue of the same products across the 2 tables and ORDER BY the sum. Result is sorting...
Read more >Improve performance for order by with columns from many ...
You are sorting by two columns, each from a different table, while you join on two other columns. This makes it impossible for...
Read more >Create a query based on multiple tables
Build a select query by using tables with a many-to-many relationship · On the Create tab, in the Queries group, click Query Design....
Read more >SQL Order By
ORDER BY syntax. SELECT column-names; FROM table-name; WHERE condition; ORDER BY column-names [ASC, DESC]. column-names -- one or more columns names on ...
Read more >How To Use GROUP BY and ORDER BY in SQL
Two common statements in SQL that help with sorting your data are GROUP BY and ORDER ... Next, insert some sample data into...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Maybe it makes sense to apply the specified “orderBy” column-list top down in the expected dataset, depending upon occurrence/existence: Example: orderBy={“id”, “uuid”} in expected-fo.yml: table1:- id: 1 name: “Foo1” table2:- uuid: “fdfsd-fdfsd-fdfds” name: “Foo2” table3:- id: 3 uuid: “abc-def-ghj” name: “Foo3”
shouldn’t throw any exception but:- sort table1 by “id”- sort table2 by “uuid”- sort table3 by “id”, then “uuid”
I agree that would be better if we could specify table and column in order by I’m just not sure if there is a simple way to do that without polluting/making the API harder to use
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Fixed according to @jenskreidler comment.