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.

How to get all data from my Model?

See original GitHub issue

My class looks like this:

class WaitPayment(BaseModel):
    txn_id = TextField(unique=True, primary_key=True)
    discord_id = TextField()
    ms_expires = DecimalField()

and I want to recieve all of its records as a dict. However, when I use WaitPayment.select() or WaitPayment.select().dicts(), it returns:

SELECT "t1"."txn_id", "t1"."discord_id", "t1"."ms_expires" FROM "waitpayment" AS "t1"

in the terminal, which is not what I want. I do not want the sql query, I want the result. Any help? Thanks.

Issue Analytics

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

github_iconTop GitHub Comments

0reactions
peepo5commented, Jan 18, 2022

To answer my own question, yes you must iterate. @coleifer are there any ways of not iterating to save time? like recieving an array of classes instead of just something to iterate upon. Thanks. And please give some explanation rather than just sending a link, thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get all data from a Eloquent Model with it's relations?
Try placing a company_id column in your users table and fill the column with the respective company id. – adam. Nov 10, 2020...
Read more >
Get all data from a model - Odoo
Hi i try to get all row of a model in odoo 9 But, it returns only 290 rows of total 310 rows...
Read more >
Retrieving Your Data - 2.x - CakePHP Cookbook
Find is the multifunctional workhorse of all model data-retrieval functions. $type can be 'all' , 'first' , 'count' ...
Read more >
Model instance reference - Django documentation
Model instance reference¶. This document describes the details of the Model API. It builds on the material presented in the model and database...
Read more >
Introduction to the Data Model and ORM - SilverStripe docs
All data tables in Silverstripe CMS are defined as subclasses of DataObject. ... this will force the data model to fetch all records...
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