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

Implement tables.metadata list & patch RPC endpoint #3646

Merged
merged 11 commits into from
Jul 2, 2024
Merged

Conversation

Anish9901
Copy link
Member

@Anish9901 Anish9901 commented Jun 27, 2024

Fixes #3645
Fixes #3647

Checklist

  • 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
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

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.

@Anish9901 Anish9901 requested a review from mathemancer June 27, 2024 21:13
@Anish9901 Anish9901 marked this pull request as ready for review June 27, 2024 21:14
@Anish9901 Anish9901 added the pr-status: review A PR awaiting review label Jun 27, 2024
@Anish9901 Anish9901 changed the title Implement tables.metadata.list RPC endpoint Implement tables.metadata list & patch RPC endpoint Jun 28, 2024

class TableMetaData(BaseModel):
database = models.ForeignKey('Database', on_delete=models.CASCADE)
schema_oid = models.PositiveBigIntegerField()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not expect a schema_oid field here. I was expecting that we'd follow the patterns we decided on for explorations wherein we'd return all the metadata for the whole database and let the front end filter it out by schema as needed.

Comment on lines 132 to 133
preview_customized = models.BooleanField(default=False)
preview_template = models.CharField(max_length=255, blank=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I'd like these fields to be renamed:

    • preview_customizedrecord_summary_customized
    • preview_templaterecord_summary_template

    These changes will serve to make our terminology more consistent across the stack.

  2. As a side note: I'm not sure we need preview_customized. I did a little digging on this and couldn't figure out why it's necessary. Perhaps we do need it. I don't think we ought to try removing it in this PR, but I just want to mention this as a heads up. I might want to remove this later once we get deeper into the record summary work before beta. If anyone seeing this comment happens to have a clear understanding of why we need this field, please comment here. A code comment explaining it would be nice too! But not worth spending much time clarifying right now.

@http_basic_auth_login_required
@handle_rpc_exceptions
def patch(
*, metadata_id: int, metadata_dict: SettableTableMetaData, **kwargs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect to pass the table OID here, not the metadata id. I don't mind the fact that this model ends up with a Django id, because presumably that's just the way that Django works. But I think our metadata APIs would be more straightforward for consumers if they didn't need to worry about the Django ids at all. Sticking solely to OIDs eliminates the need for an API consumer to maintain a mapping between table OIDs and metadata IDs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with that. However, if we go ahead with table_oid, we'd also need database_id to uniquely identify tables across multiple databases. But I do agree that this is more consistent with how our other APIs are currently set up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'd also need database_id

Agreed

@Anish9901 Anish9901 requested a review from seancolsen July 1, 2024 18:19
Copy link
Contributor

@seancolsen seancolsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Anish9901. You've addressed my feedback.

To be clear: I've not given this a full review. Brent should still review before merging.

Copy link
Contributor

@mathemancer mathemancer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, Sean seems happy with the interface, and I'm happy with the code. Nice work!

@Anish9901 Anish9901 enabled auto-merge July 2, 2024 06:15
@Anish9901 Anish9901 added this pull request to the merge queue Jul 2, 2024
Merged via the queue into develop with commit 000ebda Jul 2, 2024
37 checks passed
@Anish9901 Anish9901 deleted the table_metadata branch July 2, 2024 06:28
@kgodey kgodey added this to the Pre-beta test build #1 milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement tables.metadata.patch RPC method Implement tables.metadata.list RPC method
4 participants