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.

Question: FlowQueryList over joined dataset

See original GitHub issue

DBFlow Version: 3.0.1 Issue Kind (Bug, Question, Feature): Question

Description:

I have the following problem. I have a table, lets call it Contact and another one referencing it via ForeignKey, lets call it Phone. So one Contact can have multiple Phone numbers. I need to display a list of contacts in RecyclerView showing all phones separated by comma for each contact in a row. To make this I create ModelView in which I query contacts, left join them with phones. I load this ModelView with CursorLoader and display its data in RecyclerView. Now I end up creating ModelView for every list in my applications and this bothers me much.

The question is, can I achieve the same behaviour without ModelView?

  1. I was trying to use .queryCustomList() to get list of BaseQueryModel, but I extract all data in memory instanly this way and this is generally bad for performance. So I’m against this method.

  2. I was trying to use FlowQursorList but it can’t handle joins and cannot be used to get list of BaseQueryModel:

SQLite.select(extendedContactColumns)
            .from(Contact.class)
            .leftOuterJoin(Phone.class)
            .on(Phone_Table.contact_id.eq(1L))
            .where(Contact_Table.id.is(1L))
            .flowQueryList() <--- converts to FlowQueryList<Contact>

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
agrosnercommented, Jun 21, 2016

in develop. Use the new FlowQueryList.Builder<>(joinClass.class).cursor(cursor).build()

0reactions
agrosnercommented, Nov 13, 2016

if you specify a FlowCursorList or FlowQueryList with a Cursor, you cannot refresh() the list. I have updated the class to throw an exception. You must construct a new instance in that scenario once the Cursor has been closed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Top 10 SQL JOIN Interview Questions and How to Answer ...
Learn how to answer the most common SQL JOIN interview questions. ... It contains over 80 hands-on exercises on various JOIN topics: joining...
Read more >
Exercise: Joining Data - Kaggle
Now that you have a query to select questions on any given topic (in this case, you chose "bigquery"), you can find the...
Read more >
sql - Filtering data while joining - Stack Overflow
You seem to want filtering both in the ON clause and the WHERE clause: SELECT c.Customer, c.Year, e.Entry FROM Customer c LEFT JOIN...
Read more >
FAQ Retrieval using Query-Question Similarity and BERT ...
On the other hand, the relevance between the query and answer can be learned by using QA pairs in a FAQ database. The...
Read more >
Troubleshoot issues with joining data sources in QuickSight
You get a duplicate column or ambiguous column error. Resolution. You can't see the Add data and grid panel on the Edit dataset...
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