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.

getOne() method looks not LIMIT query

See original GitHub issue

Hi … again here.

I’m using your lib and it’s great!!.. but just one quick doubt …

I’m doing a query like:

 const query = await this._accountRepository
            .getOne()
            .where(xx => xx.sfid)
            .isNotNull();

Not it works and return a single object … BUT if i enable the logs of the query … i can see this: SELECT "entity"."lastname" AS "entity_lastname", "entity"."attivo__c" AS "entity_attivo__c", "entity"."personhasoptedoutofemail" AS "entity_personhasoptedoutofemail", "entity"."id_account_18__c" AS "entity_id_account_18__c", "entity"."sesso__c" AS "entity_sesso__c", "entity"."personcontactid" AS "entity_personcontactid", "entity"."recordtypeid" AS "entity_recordtypeid", "entity"."consenso_marketing__c" AS "entity_consenso_marketing__c", "entity"."personemail" AS "entity_personemail", "entity"."codice_fiscale__c" AS "entity_codice_fiscale__c", "entity"."consenso_marketing_email__c" AS "entity_consenso_marketing_email__c", "entity"."consenso_marketing_tel__c" AS "entity_consenso_marketing_tel__c", "entity"."name" AS "entity_name", "entity"."stato_commerciale__c" AS "entity_stato_commerciale__c", "entity"."prossimo_compleanno__c" AS "entity_prossimo_compleanno__c", "entity"."consenso_marketing_sms__c" AS "entity_consenso_marketing_sms__c", "entity"."has_whatsapp__c" AS "entity_has_whatsapp__c", "entity"."phone" AS "entity_phone", "entity"."altra_email__c" AS "entity_altra_email__c", "entity"."ownerid" AS "entity_ownerid", "entity"."ispersonaccount" AS "entity_ispersonaccount", "entity"."isdeleted" AS "entity_isdeleted", "entity"."data_scadenza_consenso_mktg__c" AS "entity_data_scadenza_consenso_mktg__c", "entity"."systemmodstamp" AS "entity_systemmodstamp", "entity"."persondonotcall" AS "entity_persondonotcall", "entity"."eta__c" AS "entity_eta__c", "entity"."alert_truffa__c" AS "entity_alert_truffa__c", "entity"."createddate" AS "entity_createddate", "entity"."personmobilephone" AS "entity_personmobilephone", "entity"."personbirthdate" AS "entity_personbirthdate", "entity"."salutation" AS "entity_salutation", "entity"."professione__c" AS "entity_professione__c", "entity"."tipo_db__c" AS "entity_tipo_db__c", "entity"."personhomephone" AS "entity_personhomephone", "entity"."firstname" AS "entity_firstname", "entity"."consenso_trattamento_dati__c" AS "entity_consenso_trattamento_dati__c", "entity"."id_anagrafica__c" AS "entity_id_anagrafica__c", "entity"."sfid" AS "entity_sfid", "entity"."id" AS "entity_id", "entity"."_hc_lastop" AS "entity__hc_lastop", "entity"."_hc_err" AS "entity__hc_err", "entity"."id_contatto_18__pc" AS "entity_id_contatto_18__pc" FROM "salesforce"."account" "entity" WHERE "entity"."sfid" IS NOT NULL

As you can see the select query looks like NOT be LIMITED to one record … (for example having LIMIT 1 at the end ) … so i ask if is possible that the limit is done in the memory ONCE the query as been hitted on the DB and has returned all records

Really thnx!!!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
freefred81commented, Oct 4, 2019

YEs … it’s very clear now … and the lib is not so complicated … i know do a ORM linq style (like EF) i’s not so easy …and you do a GREAT job… really thnx for your time and explanation!!

0reactions
IRCraziestTaxicommented, May 20, 2020

Terribly sorry for the long period of inactivity on this.

I agree with @ljobse - this seems like a problem on TypeORM’s end in one way or another. I’m going to go ahead and close this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

getOne() method looks not LIMIT query · Issue #4852 - GitHub
I'm using your lib and it's great!!.. but just one quick doubt ... I'm doing a query like: const query = await this._accountRepository...
Read more >
When use getOne and findOne methods Spring Data JPA
Retrieves an entity by its id. As we look into the implementation, we can see that it relies on EntityManager.find() to do the...
Read more >
Limiting Query Results with JPA and Spring Data JPA
In our repository method, we use the EntityManager to create a Query on which we call the setMaxResults() method.
Read more >
Select using Query Builder - typeorm - GitBook
getOne(). It builds the following SQL query: SELECT. user.id as userId, ... Note: LIMIT may not work as you may expect if you...
Read more >
Find Methods | Objection.js
This query uses joinRelated to join a many-to-many relation which also joins // the join table `persons_movies`. We specify that the `persons_movies` table ......
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