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.

Tables not defined in 'tableOrdering' option should be used in resulting dataset

See original GitHub issue

Hi everyone. I noticed strange behavior with using ‘tableOrdering’ option. For example I have 3 tables in my dataset.yml file: first_table, second_table and third_table. And in annotation ‘@DataSet’ I set ‘tableOrdering’, but add there 2 tables instead of 3: first_table and second_table. As a result, delete and insert operations isn’t executed for this table and test failed. I didn’t found any warning or error logs.

Database rider version: 1.16.0

dataset.yml

first_table:
  - name: first_record
  - name: second_record

second_table:
  - name: first_record
  - name: second_record

third_table:
  - name: first_record
  - name: second_record
@Test
@DataSet(value = "dataset.yml", tableOrdering = {"first_table", "second_table"})
@ExpectedDataSet(value = "dataset.yml")
void retrieveAll() throws Exception {

After debugging I found, that in ‘DataSetExecutorImpl.performTableOrdering(DataSetConfig dataSet, IDataSet target)’

private IDataSet performTableOrdering(DataSetConfig dataSet, IDataSet target) throws AmbiguousTableNameException {
        if (dataSet.getTableOrdering().length > 0) {
            target = new FilteredDataSet(new SequenceTableFilter(dataSet.getTableOrdering(), dbUnitConfig.isCaseSensitiveTableNames()), target);
        }
        return target;
    }

We set FilteredDataSet and his field _filter contains tables only from ‘tableOrdering’ property. As a result all Iterators of this dataset iterate only by those tables.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RomashkoVictorcommented, Nov 10, 2020

yes, I agree with you. Current situation is bad and error with incorrect ordering is much better=)

0reactions
rmpestanocommented, Nov 10, 2020

Sure, in this case add all tables present in dataset in tableOrdering to avoid surprises. Also you’ll probably get a constraint violation error if the order is incorrect and then you can fix it. In current situation the table which is not present in tableOrdering is simple removed from the dataset so you don’t even get an error because the table is not populated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

65916 - Accessing a Google BigQuery table without including ...
When you issue a LIBNAME statement for a Google BigQuery database without including the SCHEMA= option, all tables in the project are shown ......
Read more >
Create and use tables | BigQuery - Google Cloud
Describes how to create and use standard tables in BigQuery. ... Create an empty table without a schema definition; Create a table from...
Read more >
Package 'data.table'
A logical indicating whether or not to ignore rows order in data.table. This option requires datasets to use data types on which join...
Read more >
DataItemLinkType Property - Dynamics NAV - Microsoft Learn
Use Default Values If No Match, The resulting dataset contains all ... If the DataItemLinkType property is set to SQL Advanced Options and ......
Read more >
Stata Customizable Tables and Collected Results Reference ...
That is not the same thing. table went back through the dataset, ... Our result options increase dramatically if we collect summarize, detail....
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