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.

__debug, __sql doesn't log sql queries made withing promises or resolves In Types

See original GitHub issue

Hello world, I have a query that has promises with data loaders, In those dataloaders I do queries that don’t show up in the queries

__debug{ __sql{ sql}}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
japrogramercommented, May 5, 2018

Yes I think that the sql tag should be resolved after the rest of the query is resolved … even after promises are resolved in the query. That would resolve a lot of issues.

2reactions
ktosiekcommented, Mar 10, 2019

Looking at the code of that middleware, I see it waits for all promises that where seen by the middleware before starting to resolve __sql. I think something like this might work:

class DjangoDebugContext(object):
    (...)
    def get_debug_promise(self):
        if not self.debug_promise:
            self.debug_promise = Promise.all(self.promises)
            self.promises = []
        return self.debug_promise.then(self.on_resolve_all_promises)

    def on_resolve_all_promises(self, values):
        if self.promises:
            self.debug_promise = None
            return self.get_debug_promise()
        self.disable_instrumentation()
        return self.object

    def add_promise(self, promise):
        if self.debug_promise:
            self.promises.append(promise)

Edit: it works, I’ve made a PR out of it: #591.

Read more comments on GitHub >

github_iconTop Results From Across the Web

19 - Stack Overflow
The problem is that when there is an error, the wrong query gets printed in the console.log(command) . This is because the time...
Read more >
Debugging SQL syntax errors - Metabase
Reading an error message shouldn't feel like solving a riddle. This debugging guide explains what you can do about stubborn queries that refuse...
Read more >
Understand and resolve SQL Server blocking problems
The article describes blocking in SQL Server and demonstrates how to troubleshoot and resolve blocking. In this article, the term connection ...
Read more >
Better Error Handling In NodeJS With Error Classes
This article is for JavaScript and NodeJS developers who want to improve error-handling in their applications.
Read more >
msnodesqlv8 - npm
This library has full compatibility with MS SQL Server using an MS ODBC driver. Many functions e.g. open, query, connection pool, prepare, transactions, ......
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