question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for orderBy in multiple tables

See original GitHub issue

orderBy 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:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jenskreidlercommented, Aug 23, 2019

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”

Am Freitag, 23. August 2019, 13:50:50 MESZ hat Rafael M. Pestano <notifications@github.com> Folgendes geschrieben:  

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.

0reactions
rmpestanocommented, Sep 8, 2019

Fixed according to @jenskreidler comment.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found