-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3610 from mathesar-foundation/schemas_delete
Implement `schemas.delete` RPC method
- Loading branch information
Showing
9 changed files
with
112 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
from db.connection import execute_msar_func_with_engine | ||
from db.connection import execute_msar_func_with_engine, exec_msar_func | ||
|
||
|
||
def drop_schema(schema_name, engine, cascade=False, if_exists=False): | ||
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): | ||
""" | ||
Drop a schema by its OID. | ||
If no schema exists with the given oid, an exception will be raised. | ||
Args: | ||
conn: a psycopg connection | ||
id: the OID of the schema to drop. | ||
cascade: Whether to drop the dependent objects. | ||
""" | ||
return execute_msar_func_with_engine( | ||
engine, 'drop_schema', schema_name, cascade, if_exists | ||
).fetchone()[0] | ||
exec_msar_func(conn, 'drop_schema', id, cascade).fetchone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ To use an RPC function: | |
options: | ||
members: | ||
- list_ | ||
- delete | ||
- SchemaInfo | ||
|
||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters