cardinal_pythonlib.sqlalchemy.alembic_ops¶
Original code copyright (C) 2009-2022 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Support functions for Alembic, specifically to support view creation.
From https://alembic.readthedocs.org/en/latest/cookbook.html.
HAS NO TYPE ANNOTATIONS - Alembic uses inspect.getargspec()
, which chokes
on them.
-
class
cardinal_pythonlib.sqlalchemy.alembic_ops.
CreateSPOp
(target)[source]¶ Represents
CREATE FUNCTION
(reversed byDROP FUNCTION
) [sp = stored procedure].Parameters: target – instance of ReplaceableObject
-
class
cardinal_pythonlib.sqlalchemy.alembic_ops.
CreateViewOp
(target)[source]¶ Represents
CREATE VIEW
(reversed byDROP VIEW
).Parameters: target – instance of ReplaceableObject
-
class
cardinal_pythonlib.sqlalchemy.alembic_ops.
DropSPOp
(target)[source]¶ Represents
DROP FUNCTION
(reversed byCREATE FUNCTION
) [sp = stored procedure].Parameters: target – instance of ReplaceableObject
-
class
cardinal_pythonlib.sqlalchemy.alembic_ops.
DropViewOp
(target)[source]¶ Represents
DROP VIEW
(reversed byCREATE VIEW
).Parameters: target – instance of ReplaceableObject
-
class
cardinal_pythonlib.sqlalchemy.alembic_ops.
ReversibleOp
(target)[source]¶ Represents a DDL (SQL) migration operation that can be reversed; e.g. the combination of
CREATE VIEW
andDROP VIEW
.Parameters: target – instance of ReplaceableObject
-
classmethod
invoke_for_target
(operations, target)[source]¶ This method is proxied on the
Operations
class, via theOperations.drop_sp()
method.
-
classmethod
-
cardinal_pythonlib.sqlalchemy.alembic_ops.
create_sp
(operations, operation)[source]¶ Implements
CREATE FUNCTION
.Parameters: - operations – instance of
alembic.operations.base.Operations
- operation – instance of
ReversibleOp
Returns: None
- operations – instance of
-
cardinal_pythonlib.sqlalchemy.alembic_ops.
create_view
(operations, operation)[source]¶ Implements
CREATE VIEW
.Parameters: - operations – instance of
alembic.operations.base.Operations
- operation – instance of
ReversibleOp
Returns: None
- operations – instance of
-
cardinal_pythonlib.sqlalchemy.alembic_ops.
drop_sp
(operations, operation)[source]¶ Implements
DROP FUNCTION
.Parameters: - operations – instance of
alembic.operations.base.Operations
- operation – instance of
ReversibleOp
Returns: None
- operations – instance of
-
cardinal_pythonlib.sqlalchemy.alembic_ops.
drop_view
(operations, operation)[source]¶ Implements
DROP VIEW
.Parameters: - operations – instance of
alembic.operations.base.Operations
- operation – instance of
ReversibleOp
Returns: None
- operations – instance of