-
-
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 schemas.delete
RPC method
#3610
Conversation
@mathemancer heads up that
I fixed the test in 529ffef by making the assertions order-independent. That commit is unrelated to this PR, but I tacked it on here for simplicity's sake. I'm happy to cherry pick this into a separate PR if you prefer. I wouldn't be surprised if we see this flakiness crop up in other PRs until we merge this fix. |
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.
Looks good overall. The only change to request is the argument order of the RPC function.
def drop_schema_via_name(engine, name, cascade=False): | ||
""" | ||
Drop a schema. | ||
Drop a schema by its name. | ||
|
||
If no schema exists with the given name, an exception will be raised. | ||
|
||
Deprecated: | ||
Use drop_schema_via_oid instead. This function is deprecated because we | ||
are phasing out name-based operations in favor of OID-based operations | ||
and we are phasing out SQLAlchemy in favor of psycopg. | ||
|
||
Args: | ||
schema_name: Name of the schema to drop. | ||
engine: SQLAlchemy engine object for connecting. | ||
cascade: Whether to drop the dependent objects. | ||
if_exists: Whether to ignore an error if the schema doesn't | ||
exist. | ||
engine: SQLAlchemy engine object for connecting. name: Name of the | ||
schema to drop. cascade: Whether to drop the dependent objects. | ||
""" | ||
execute_msar_func_with_engine(engine, 'drop_schema', name, cascade).fetchone() | ||
|
||
|
||
Returns: | ||
Returns a string giving the command that was run. | ||
def drop_schema_via_oid(conn, id, cascade=False): |
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.
It's debatable whether the specific name drop_schema_via_oid
will be relevant once drop_schema_via_name
is removed when the model is removed. However, I don't think we need to agree on or change this detail to merge this PR.
mathesar/rpc/schemas.py
Outdated
@rpc_method(name="schemas.delete") | ||
@http_basic_auth_login_required | ||
@handle_rpc_exceptions | ||
def delete(*, database_id: int, schema_id: int, **kwargs) -> None: |
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.
def delete(*, database_id: int, schema_id: int, **kwargs) -> None: | |
def delete(*, schema_id: int, database_id: int, **kwargs) -> None: |
I think we should switch this arg order to match the other RPC functions.
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.
Fixed in ea51de0
Ready for re-review @mathemancer |
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, this looks great. Thank you!
Fixes #3609
Checklist
Update index.md
).develop
branch of the repositoryDeveloper Certificate of Origin
Developer Certificate of Origin