-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 a Dev UI Screen for Agroal (DB) #43618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is nice and I can definitely see the value but I wonder if it won't open a can of worms. Data is hard and displaying the data coming directly from a table is not that easy - see my comments inline for a few cases where things might go wrong.
Now, what I don't know is if it's just a matter of tweaking things a bit or if it will be a continuous stream of corner cases to fix.
/cc @yrodiere
extensions/agroal/deployment/src/main/resources/dev-ui/qwc-agroal-datasource.js
Outdated
Show resolved
Hide resolved
extensions/agroal/deployment/src/main/resources/dev-ui/qwc-agroal-datasource.js
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first all - love the feature and something I did some early experiments on (but without the ui skills :)
I have concerns though that is similar to @gsmet and something we at least should consider before pushing in, in no particular order:
-
which schema are you listing? the default the connection is for or all of them ?
with JPA on top users can very specifically limit what data is ever exposed but here its all raw... -
data security - we already have concerns about exposing config data in devui; but now we will potentially expose a query interface to all data in the raw jdbc connection on the agroal connection? ...should we turn this off by default or at least have option to turn on? (maybe separate devmode only extension?)
-
feature creep - this will open up for massive set of feature requests and can keep us busy forever. We should either agree to deliberately keep this very simple or explore if more suitable reuse of some existing webbased db ui ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looking good -- though I added a few comments below.
This PR adds a Dev UI screen for Agroal (so any time you have a DB).
Note Agroal is not necessarily present if you have a reactive datasource. You might need a similar Dev UI for reactive SQL clients...
Now, what I don't know is if it's just a matter of tweaking things a bit or if it will be a continuous stream of corner cases to fix.
I suspect there will be lots of corner cases, though whether we get to hear about it will depend on the success of this feature.
I know that I would rather work on #39584 than fix an endless stream of bugs related to JDBC quirks -- Hibernate at least hides some of them.
But I agree this is a (very!) nice start, so perhaps we could merge this as a "preview" feature, and depending on feedback we'll decide whether we keep it as is, or try to migrate it to something more "Hibernate-focused" as part of #39584? E.g. if data types are really too hard to handle, Hibernate could help (a lot).
extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/devui/DatabaseInspector.java
Outdated
Show resolved
Hide resolved
extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/devui/DatabaseInspector.java
Outdated
Show resolved
Hide resolved
extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/devui/DatabaseInspector.java
Outdated
Show resolved
Hide resolved
extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/devui/DatabaseInspector.java
Outdated
Show resolved
Hide resolved
Looks like a great feature! Now, as @yrodiere said, I want to be able to run HQL queries, not just SQL ones ;) |
extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/devui/DatabaseInspector.java
Outdated
Show resolved
Hide resolved
9085365
to
1a9b32d
Compare
This comment has been minimized.
This comment has been minimized.
01bcab8
to
e9dccf2
Compare
Ok, there was a few comments from multiple people. I have done the following updates:
Yes, if this is requested we can look at something similar for reactive drivers.
I think we should still have a Hibernate Dev UI Presence (and the log stream :) ) - however for this one the aim is to give a basic DB View. I think we should have both. What I did:
W.r.t HQL queries, this is something we will need to add to the Hibernate extension.
The schema(s) the user of the connection (as defined in the properties) have access too. We might need to fine tune this for dev service DB. ( I get this from Agroal)
There is now a option to turn this off totally (default false) or turn on/off the sql query part (default off). So by default you will not be able to run queries. You need to turn this on in config. Apart from that (after chatting to @yrodiere) I also only allow this feature on local databases (so this feature will not be enabled for datasouces that is not local) So not only do we have the LocalHostFilter for dev UI that only allow requests when the host is localhost, but now for this I also made it:
As with anything else in Quarkus, we will make a call on every feature request. The plan is too keep it simple. So real complex things users will still use an external tool (like their IDE)
|
This comment has been minimized.
This comment has been minimized.
e9dccf2
to
f3058be
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
b724e76
to
6aab246
Compare
🎊 PR Preview fc237a6 has been successfully built and deployed to https://quarkus-pr-main-43618-preview.surge.sh/version/main/guides/
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
6aab246
to
17e788d
Compare
This comment has been minimized.
This comment has been minimized.
5d9b3cf
to
6693652
Compare
This comment has been minimized.
This comment has been minimized.
6693652
to
8a81384
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We have a green CI !! |
8a81384
to
8583576
Compare
As discussed with Phillip, I added a commit on top that configures the resolver for dev mode in |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Those are flaky test failures. They passed locally for me. |
8583576
to
0b4e64d
Compare
Signed-off-by: Phillip Kruger <phillip.kruger@gmail.com>
0b4e64d
to
bedb8c5
Compare
Status for workflow
|
Status for workflow
|
/** | ||
* Dev UI. | ||
*/ | ||
@WithDefaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This annotation is used for maps only according to the docs https://smallrye.io/smallrye-config/Main/config/mappings/#withdefaults. Does it have any function here?
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-agroal-dev</artifactId> | ||
<scope>test</scope> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this test dependency added here? I can't see any other file or change in this module. Maybe it deserves a comment above the dependency for others to understand why is it present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This dependency was removed in a follow up PR a84b285
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, thank you.
</goals> | ||
<configuration> | ||
<conditionalDevDependencies> | ||
<artifact>${project.groupId}:${project.artifactId}-dev:${project.version}</artifact> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's cool you can do that, the <artifactId>quarkus-agroal-dev</artifactId>
is hardcoded anyway and if someone is looking for usage (or simply trying to figure how it works) of the quarkus-agroal-dev
, they won't find it. If the artifactId
ever changes, then also will have to change the quarkus-agroal-dev
so I think this is unnecessary and it would be easier to read if the value was hardcoded.
(and you already have this dependency name hardcoded in the deployment module)
private static record Datasource(String name, String jdbcUrl, boolean isDefault) { | ||
} | ||
|
||
private static record DataSet(List<String> cols, List<Map<String, String>> data, String error, String message, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI inner-records are always static
&& !lsql.contains("update ") | ||
&& !lsql.contains("delete ") | ||
&& !lsql.contains("insert ") | ||
&& !lsql.contains("create ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this can be stupid question but I didn't try to run this new cool feature yet, what happens if I do select timestamp_create from products
, this this contains("create ")
matches?
This PR adds a Dev UI screen for Agroal (so any time you have a DB).
You can view a more detailed demo here: https://youtu.be/-ms_2ayumkk