Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to "flag" queries #476

Open
nrother opened this issue Jan 13, 2017 · 10 comments
Open

Add an option to "flag" queries #476

nrother opened this issue Jan 13, 2017 · 10 comments

Comments

@nrother
Copy link
Contributor

nrother commented Jan 13, 2017

It would be nice if it would be possible to mark SQL queries in some way to find them in the Panel if there are many of them. Maybe one could abuse applyOptions for this:

$query->applyOptions(['debug.mark' => true]);

Maybe queries could be even automatically tagged based on their origin (primary/secondary).

I tried a quick attempt to hack in this myself, but this seemed not that easy, unfortunately.

@lorenzo
Copy link
Member

lorenzo commented Jan 15, 2017

I like this idea

@nrother
Copy link
Contributor Author

nrother commented Jan 18, 2017

I just looked around a bit to see how this could be implement, but I haven't found a nice way yet. The LoggedQuery the panel has access to does not contain the original query Object, but only a query string. So I currently don't see a way to pass information from the app to debugkit without changing LoggingStatement in the core.

@dereuromark
Copy link
Member

👍 @lorenzo Any ideas here?

@thinkingmedia
Copy link
Contributor

I think this is a great idea, and was going to open a new ticket for something like this. Except my idea was to "tag" queries so that we could filter them in the SQL log.

There would be the default view of the SQL log in chronological order, but across the top would be checkboxes for each group. Unchecking a group would hide those queries from the log. It would just be a visual hiding of matching DOM elements.

I would also prefer to update the Query object interface to allow a more verbose way of tagging. It just makes it easier to work with.

  $query->tag('documents');
  $query->tag(['documents','reports']);

A query can be tagged with multiple tags.

I would also add tags for internal queries like the "SHOW INDEXES" and "SHOW COLUMNS" that are frequently done by the core. Maybe just tag them with "cake" or something like that.

Also (another idea) the models could auto tag the model name when the query object is created. I think this could be a very useful feature.

@markstory
Copy link
Member

Tagging queries is an interesting idea. Should the tags be an map instead of a list? That would allow us to record metadata about the queries more effectively.

@thinkingmedia
Copy link
Contributor

I'm not sure that I understand, but keep in mind two tags could share same query object.

@markstory
Copy link
Member

Something like $query->tags(['type' => 'schema', 'flagged' => true]) this would allow us and userland code to tag/label queries with richer information.

@ravage84
Copy link
Member

The new CakePHP 5.x tracing query execution feature could be of help to some degree.

@othercorey othercorey modified the milestones: Future, 5.x Oct 1, 2023
@dereuromark
Copy link
Member

Is there someone who wants to provide a PR here?

Copy link

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

@github-actions github-actions bot added the stale label Aug 10, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 25, 2024
@ravage84 ravage84 reopened this Aug 25, 2024
@github-actions github-actions bot removed the stale label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants