This adds an RPC function called columns.list that takes a database_id and table_oid as input, and returns information about the columns of the identified table.
Technical details
The function is documented in the new documentation added in this PR, and those docs should be sufficient to explain its usage, and the return format. If not, request a change to those docs.
The SQL test suite was modified to avoid using the pgTAP setup function feature, since that bogs the tests down too much.
This PR also provides an example of how and where I think we should organize the code for the RPC functions. Of note:
mathesar.rpc.columns.list_ is kept pretty simple. It's responsible for getting a connection using the provided utility function, and then calls other functions to actually gather data.
mathesar.rpc.columns.list_ doesn't directly use the connection to access the database, but it does call the db access function within a managed context.
mathesar.utils.columns.get_raw_display_options is a bit of scaffolding for now, since the new model hasn't been made yet.
However, its signature shouldn't change. In particular, it's supposed to manage access using the passed database_id and user
The mathesar.rpc.utils.connect function is also a stub for now, but its signature should also stay the same.
The tests are supposed to serve as an example of how I think we should proceed on testing the backend, at least until beta.
No actual calls to the database for unit testing.
More mocking to isolate functionality of piece being tested.
mathesar.tests.rpc.test_endpoints tests that the expected functions are shown, at that each is defined with the expected decorators are applied. Nothing more.
Checklist
- [X] My pull request has a descriptive title (not a vague title like `Update
index.md`).
- [ ] My pull request targets the `develop` branch of the repository
- [X] My commit messages follow [best practices][best_practices].
- [X] My code follows the established code style of the repository.
- [X] I added tests for the changes I made (if applicable).
- [X] I added or updated documentation (if applicable).
- [X] I tried running the project locally and verified that there are no
visible errors.
[best_practices]:https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53
## Developer Certificate of Origin
Developer Certificate of Origin
```
Developer Certificate of Origin
Version 1.1
Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
Developer's Certificate of Origin 1.1
By making a contribution to this project, I certify that:
(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.
(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.
```
Fixes #3549 Fixes #3571
This adds an RPC function called
columns.list
that takes adatabase_id
andtable_oid
as input, and returns information about the columns of the identified table.Technical details
pgTAP
setup function feature, since that bogs the tests down too much.mathesar.rpc.columns.list_
is kept pretty simple. It's responsible for getting a connection using the provided utility function, and then calls other functions to actually gather data.mathesar.rpc.columns.list_
doesn't directly use the connection to access the database, but it does call the db access function within a managed context.mathesar.utils.columns.get_raw_display_options
is a bit of scaffolding for now, since the new model hasn't been made yet.database_id
anduser
mathesar.rpc.utils.connect
function is also a stub for now, but its signature should also stay the same.mathesar.tests.rpc.test_endpoints
tests that the expected functions are shown, at that each is defined with the expected decorators are applied. Nothing more.Checklist
- [X] My pull request has a descriptive title (not a vague title like `Update index.md`). - [ ] My pull request targets the `develop` branch of the repository - [X] My commit messages follow [best practices][best_practices]. - [X] My code follows the established code style of the repository. - [X] I added tests for the changes I made (if applicable). - [X] I added or updated documentation (if applicable). - [X] I tried running the project locally and verified that there are no visible errors. [best_practices]:https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53 ## Developer Certificate of OriginDeveloper Certificate of Origin
``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ```