schema_sentinel.metadata_manager.model.stage API documentation

# schema_sentinel.metadata_manager.model.stage

View Source

     1import json
     2
     3import sqlalchemy as db
     4from sqlalchemy import ForeignKey, select
     5
     6from . import CommonBase
     7
     8
     9class Stage(CommonBase):
    10    __tablename__ = "stages"
    11    stage_id = db.Column(db.String, primary_key=True)
    12    schema_id = db.Column(db.String, ForeignKey("schemas.schema_id"))
    13    stage_name = db.Column(db.String)
    14    stage_owner = db.Column(db.String)
    15    stage_url = db.Column(db.String)
    16    stage_region = db.Column(db.String)
    17    stage_type = db.Column(db.String, default="internal named")
    18    has_credentials = db.Column(db.String)
    19    has_encryption_key = db.Column(db.String)
    20    cloud = db.Column(db.String)
    21    notification_channel = db.Column(db.String)
    22    storage_integration = db.Column(db.String)
    23    comment = db.Column(db.String)
    24    created = db.Column(db.String)
    25
    26    def save(self, session) -> None:
    27        if not session.execute(self.exists()).first():
    28            session.add(self)
    29            session.commit()
    30
    31    def exists(self) -> str:
    32        return select(Stage).filter_by(stage_id=self.stage_id)
    33
    34    def __get_id__(self) -> str:
    35        id = json.loads(self.schema_id)
    36        id["stage_name"] = self.stage_name
    37        return json.dumps(id)

class Stage(schema_sentinel.metadata_manager.model.CommonBase): View Source

    10class Stage(CommonBase):
    11    __tablename__ = "stages"
    12    stage_id = db.Column(db.String, primary_key=True)
    13    schema_id = db.Column(db.String, ForeignKey("schemas.schema_id"))
    14    stage_name = db.Column(db.String)
    15    stage_owner = db.Column(db.String)
    16    stage_url = db.Column(db.String)
    17    stage_region = db.Column(db.String)
    18    stage_type = db.Column(db.String, default="internal named")
    19    has_credentials = db.Column(db.String)
    20    has_encryption_key = db.Column(db.String)
    21    cloud = db.Column(db.String)
    22    notification_channel = db.Column(db.String)
    23    storage_integration = db.Column(db.String)
    24    comment = db.Column(db.String)
    25    created = db.Column(db.String)
    26
    27    def save(self, session) -> None:
    28        if not session.execute(self.exists()).first():
    29            session.add(self)
    30            session.commit()
    31
    32    def exists(self) -> str:
    33        return select(Stage).filter_by(stage_id=self.stage_id)
    34
    35    def __get_id__(self) -> str:
    36        id = json.loads(self.schema_id)
    37        id["stage_name"] = self.stage_name
    38        return json.dumps(id)

The base class of the class hierarchy.

When called, it accepts no arguments and returns a new featureless instance that has no instance attributes and cannot be given any.

Stage(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in `kwargs`.

Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.

stage_id
schema_id
stage_name
stage_owner
stage_url
stage_region
stage_type
has_credentials
has_encryption_key
cloud
notification_channel
storage_integration
comment
created
def save(self, session) -> None: View Source

    27    def save(self, session) -> None:
    28        if not session.execute(self.exists()).first():
    29            session.add(self)
    30            session.commit()

def exists(self) -> str: View Source

    32    def exists(self) -> str:
    33        return select(Stage).filter_by(stage_id=self.stage_id)