-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
Cannot filter /schema/objects endpoint #456
Comments
Hi @MichalisDBA is this where you want to expose schema objects in your application? Was this so you can expose in a selector some categories or particular domains to your app users? Or did you have some other uses in mind of schema selection in your application you are building with DB2Rest? Learning more about your use cases will help us understand better and perhaps come up with more logical filtering mechanisms to expose schema objects when the db user configured has those rights. |
Hi @thadguidry maybe would be better to be configurabled via env variables the schema/objects path. That way i can give a user a single endpoint that he can see what objects are available to him to query instead of maintaining a list for every user of what he can query. |
Righto. OK. Hmm, isn't there a nice custom SQL expression to use instead for this with Oracle where you can query the USER_OBJECTS view? I know I can do this easily in PostgreSQL. Regardless, this https://docs.oracle.com/en/database/oracle/oracle-database/23/admin/managing-schema-objects.html#GUID-827749E0-E67C-44DB-ABA4-2596167F2EAE in section 17.13 does seem to resonate with this issue. Perhaps custom query to return ALL_OBJECTS or USER_OBJECTS views? Let me know. |
We "could" in theory more easily expose this through the API via something that might look like:
or maybe @dhrubo ? |
JDBC meta data builder queries these tables under the hood. Because the driver is implemented by the database vendor. We rely on the metadata to provide the endpoint.Essentially it serves from the schema cache. We can add the filters to this endpoint. Should be easy as the type of object is also in the cache. |
Sorry i think you misunderstand me. I am talking about the objects that are cached when you start db2rest. db2rest introduced an |
Will add filters in 0.2.9 😁 |
well, the problem with that endpoint is that...
@kdhrubo Not so sure about an endpoint named like that? |
If a table named schema is present in user schema it will be cached and returned by this query. |
Huh? So confused. Then how do I tell it the difference between...
SELECT * FROM information_schema.role_table_grants WHERE grantee = 'YOUR_USER'; |
This endpoint ends with When you want to view the records of the schema table then that endpoint does not end with I am not sure what query the JDBC driver actually runs under the hood. |
@kdhrubo I understand that. But that's like saying your sub-collection is dictating the actual real collection. But I am saying that it is not the way to do it properly at all. It actually breaks the REST best practices with Nesting to show Relationships between Sub-collection Resources, as well as noun pluralization for Collection Resources. /posts/author We are doing it Non-RESTful then. And I don't really like that or appreciate that we break many RESTful best practices. |
Not really it's very common to use command or controller pattern for such scenarios. If you can suggest a better name for this end point we can make changes. |
It's very common that 1000's of developers do it WRONG. I absolutely know that. It's a common misunderstanding that gets abused in command and controller patterns because of lack of knowledge of RESTful Collection Naming conventions. We're the experts here and should stick to correct conventions of industry norms. I'd suggest that we stick to our original plan of the first Collection to always be the
This is like saying, give me the resource document for schema, version, help, etc. Google does this sorta thing for their API's, for example, play around
Btw, even JSON fields (keys) can use prefix conventions for various reasons:
When a The URL Original URL: |
Makes sense..we can adopt the $ pattern. Can you pls review the join syntax and recommend there (a separate issue please) 🥺 |
Will be available in 0.2.9 release |
@MichalisDBA - please share your feedback on this issue. let us know if it can be closed. |
Yes it is working fine. Just mentioned in the docs that to search for a table you have to use |
Closing follow up here - |
Can not filter
/schema/objects
endpoint to search for specific schemas, tables, views./schema/objects?filter=schema==
/schema/objects?filter=name==
/schema/objects?filter=type==
The text was updated successfully, but these errors were encountered: