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.

Hi,

Is there a proper way to inspect query before execution? I want to get table name and joined table names of the query.

var query = knex.select('*').from('ua_entity').innerJoin('ua_field', 'ua_field.entity_id', 'ua_entity.id');

I can use non-public attributes. However this is of course inappropriate.

var table = query._single.table;
var joinedTable = query._statements[1].table; // Or by iteration of _statements

If there isn’t any public attribute/function for inspection, could you please add that feature at least for getting table names and column names of the query?

Thank you.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tgriessercommented, Jan 14, 2015

Yes this is the main focus of an internal overhaul coming soon.

Everything will be extremely easy to inspect, essentially every piece of the query builder will be accessible as an es6 iterator. Hang tight 😃

0reactions
mattbrunetticommented, May 18, 2017

@tgriesser Did that internal overhaul happen?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query inspection - Tinkerwell
Query inspection #. Tinkerwell allows you to inspect any code snippet and see all of the underlying Eloquent queries that were executed in...
Read more >
Physical Inspections Query Page - HUD
Welcome to the public HUD property physical inspections query page. ... access to the scheduling activities of physical inspections for HUD-held properties.
Read more >
Code Inspections in SQL | PhpStorm Documentation - JetBrains
In USING clauses, a column name must be present in both tables, and the SELECT query will automatically join those tables by using...
Read more >
How To Use Grafana's Query Inspector to troubleshoot issues
Query Inspector is a new feature that was added to Grafana v4.5. It shows query requests and responses. This can be helpful if...
Read more >
Get query performance insights | BigQuery - Google Cloud
Describes how to use the query execution graph to diagnose query performance issues, and to see query performance insights.
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