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

Read connections in SQL Log panel? #1003

Open
ryanolton opened this issue May 15, 2024 · 3 comments · Fixed by #1033
Open

Read connections in SQL Log panel? #1003

ryanolton opened this issue May 15, 2024 · 3 comments · Fixed by #1033
Milestone

Comments

@ryanolton
Copy link

I recently stumbled across this great feature that allows read-only connections, but I do not see any queries using the "read" connection in the SQL Log panel within DebugKit.

Does DebugKit support these "read" connections? Perhaps I'm missing some configuration setting?

The panel code seems to look for unique connections, in this cause it finds "default", but the "read" and "write" config keys specified seem to both be a part of "default", so they're not seen as two different connections. The end result is that the SQL Log panel only shows "write" connections, no "read" connections are visible.

'default' => [
	'className' => Connection::class,
	'driver' => Postgres::class,
	'encoding' => 'utf8',
	'host' => 'localhost',
	'username' => 'test',
	'password' => 'test',
	'database' => 'test_db',
	'read' => [
		'database' => 'read_test_db',
	],
	'write' => [
		'database' => 'test_db',
	],
	'log' => false,
],

Here is the original PR for this feature: cakephp/cakephp#16785

@markstory markstory added this to the 5.x milestone May 15, 2024
@markstory
Copy link
Member

DebugKit doesn't know about connection roles yet, we'd need to improve how debugkit collects queries to make that possible.

@ryanolton
Copy link
Author

@LordSimal closing this issue may have been a bit hasty. While I indeed see the Role column, I only see write queries within the DebugKit SQL panel. As I convert queries to use the read role, they disappear from the panel altogether.

I suspect that was at least part of what @markstory meant in his comment above; the DebugKit SQL panel doesn't appear to be aware of read queries as far as I can tell.

@LordSimal LordSimal reopened this Jan 1, 2025
@LordSimal
Copy link
Contributor

Thats because https://github.com/cakephp/debug_kit/blob/5.x/src/Panel/SqlLogPanel.php#L57 only fetches the write role, not the read role.

Will have to tackle this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@markstory @ryanolton @LordSimal and others