-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
Conversation
tables.metadata.list
RPC endpointtables.metadata
list
& patch
RPC endpoint
mathesar/models/base.py
Outdated
|
||
class TableMetaData(BaseModel): | ||
database = models.ForeignKey('Database', on_delete=models.CASCADE) | ||
schema_oid = models.PositiveBigIntegerField() |
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.
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.
mathesar/models/base.py
Outdated
preview_customized = models.BooleanField(default=False) | ||
preview_template = models.CharField(max_length=255, blank=True) |
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.
-
I'd like these fields to be renamed:
preview_customized
→record_summary_customized
preview_template
→record_summary_template
These changes will serve to make our terminology more consistent across the stack.
-
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.
mathesar/rpc/tables/metadata.py
Outdated
@http_basic_auth_login_required | ||
@handle_rpc_exceptions | ||
def patch( | ||
*, metadata_id: int, metadata_dict: SettableTableMetaData, **kwargs |
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.
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.
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.
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.
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.
we'd also need
database_id
Agreed
…o use table_oid instead of metadata_id
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 @Anish9901. You've addressed my feedback.
To be clear: I've not given this a full review. Brent should still review before merging.
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.
Okay, Sean seems happy with the interface, and I'm happy with the code. Nice work!
Fixes #3645
Fixes #3647
Checklist
Update index.md
).develop
branch of the repositoryvisible errors.
Developer Certificate of Origin
Developer Certificate of Origin