Exemple #1
0
    def __init__(self, server: 's.Server', parent: NodeObject, name: str, datatype: str):
        """
        Initializes a new instance of a Column
        :param server: Connection to the server/database that this object will belong to
        :param parent: Parent object of the column, should be a Table/View
        :param name: Name of the column
        :param datatype: Type of the column
        """
        self._server = server
        self._parent: Optional['NodeObject'] = parent
        self._name: str = name
        self._oid: Optional[int] = None
        self._is_system: bool = False

        self._child_collections: Dict[str, NodeCollection] = {}
        self._property_collections: List[NodeLazyPropertyCollection] = []
        # Use _column_property_generator instead of _property_generator
        self._full_properties: NodeLazyPropertyCollection = self._register_property_collection(self._column_property_generator)

        ScriptableCreate.__init__(self, self._template_root(server), self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server), self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server), self._macro_root(), server.version)

        self._datatype: str = datatype
        self._has_default_value: Optional[bool] = None
        self._not_null: Optional[bool] = None

        self._column_ordinal: int = None
        self._is_key: bool = None
        self._is_readonly: bool = None
        self._is_unique: bool = None
        self._type_oid: int = None
        self._default_value: Optional[str] = None
        self._is_auto_increment = None
Exemple #2
0
    def __init__(self, server: 's.Server', parent: NodeObject, name: str,
                 datatype: str):
        """
        Initializes a new instance of a Column
        :param server: Connection to the server/database that this object will belong to
        :param parent: Parent object of the column, should be a Table/View
        :param name: Name of the column
        :param datatype: Type of the column
        """
        NodeObject.__init__(self, server, parent, name)
        ScriptableCreate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)

        self._datatype: str = datatype

        self._has_default_value: Optional[bool] = None
        self._not_null: Optional[bool] = None

        self._column_ordinal: int = None
        self._is_key: bool = None
        self._is_readonly: bool = None
        self._is_unique: bool = None
        self._type_oid: int = None
        self._default_value: Optional[str] = None
        self._is_auto_increment = None
Exemple #3
0
 def __init__(self, server: 's.Server', parent: NodeObject, name: str):
     NodeObject.__init__(self, server, parent, name)
     ScriptableCreate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableDelete.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableUpdate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableSelect.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     self._schema: str = None
     self._scid: int = None
     # Declare child items
     self._check_constraints: NodeCollection[
         CheckConstraint] = self._register_child_collection(CheckConstraint)
     self._columns: NodeCollection[
         Column] = self._register_child_collection(Column)
     self._exclusion_constraints: NodeCollection[
         ExclusionConstraint] = self._register_child_collection(
             ExclusionConstraint)
     self._foreign_key_constraints: NodeCollection[
         ForeignKeyConstraint] = self._register_child_collection(
             ForeignKeyConstraint)
     self._index_constraints: NodeCollection[
         IndexConstraint] = self._register_child_collection(IndexConstraint)
     self._indexes: NodeCollection[Index] = self._register_child_collection(
         Index)
     self._rules: NodeCollection[Rule] = self._register_child_collection(
         Rule)
     self._triggers: NodeCollection[
         Trigger] = self._register_child_collection(Trigger)
Exemple #4
0
    def __init__(self, server: 's.Server', parent: NodeObject, name: str):
        NodeObject.__init__(self, server, parent, name)
        ScriptableCreate.__init__(self, self._template_root(server), self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server), self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server), self._macro_root(), server.version)

        # Declare the optional parameters
        self._can_create: Optional[bool] = None
        self._has_usage: Optional[bool] = None
Exemple #5
0
 def __init__(self, server: 's.Server', parent: NodeObject, name: str):
     NodeObject.__init__(self, server, parent, name)
     ScriptableCreate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableDelete.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableUpdate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     self._schema: str = None
     self._scid: int = None
Exemple #6
0
    def __init__(self, server: 's.Server', name: str):
        """
        Initializes internal state of a Role object
        """
        NodeObject.__init__(self, server, None, name)
        ScriptableCreate.__init__(self, self._template_root(server), self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server), self._macro_root(), server.version)

        # Declare basic properties
        self._can_login: Optional[bool] = None
        self._is_super: Optional[bool] = None
Exemple #7
0
 def __init__(self, server: 's.Server', parent: NodeObject, name: str):
     """
     Initializes a new instance of an rule
     :param server: Server that owns the rule
     :param parent: Parent object of the rule. Should be Table/View
     :param name: Name of the rule
     """
     NodeObject.__init__(self, server, parent, name)
     ScriptableCreate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableDelete.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableUpdate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
    def __init__(self, server: 's.Server', parent: NodeObject, name: str):
        NodeObject.__init__(self, server, parent, name)
        ScriptableCreate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)

        # Declare the basic properties
        self._description: Optional[str] = None
        self._language_name: Optional[str] = None
        self._owner: Optional[str] = None
        self._schema: str = None
        self._scid: int = None
Exemple #9
0
 def __init__(self, server: 's.Server', parent: NodeObject, name: str):
     NodeObject.__init__(self, server, parent, name)
     ScriptableCreate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableDelete.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableUpdate.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     ScriptableSelect.__init__(self, self._template_root(server),
                               self._macro_root(), server.version)
     self._schema: str = None
     self._scid: int = None
     self._database = self.get_database_node()
     # Declare child items
     self._columns: NodeCollection[
         Column] = self._register_child_collection(Column)
Exemple #10
0
 def __init__(self, server: 's.Server', parent: NodeObject, name: str):
     """
     Initializes internal state of a DataType object
     :param server: Server that owns the role
     :param name: Name of the role
     """
     NodeObject.__init__(self, server, parent, name)
     ScriptableCreate.__init__(self, self._template_root(self.server),
                               self._macro_root(), self.server.version)
     ScriptableDelete.__init__(self, self._template_root(self.server),
                               self._macro_root(), self.server.version)
     ScriptableUpdate.__init__(self, self._template_root(self.server),
                               self._macro_root(), self.server.version)
     self._schema: str = None
     self._scid: int = None
     self._additional_properties: NodeLazyPropertyCollection = self._register_property_collection(
         self._additional_property_generator)
Exemple #11
0
    def __init__(self, server: 's.Server', parent: NodeObject, name: str):
        """
        Initializes a new instance of a trigger
        :param server: Connection the trigger belongs to
        :param parent: Parent object of the trigger. Should be Table/View
        :param name: Name of the trigger
        """
        NodeObject.__init__(self, server, parent, name)
        ScriptableCreate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)

        # Declare Trigger-specific basic properties
        self._is_enabled: Optional[bool] = None
    def __init__(self, server: 's.Server', parent: NodeObject, name: str):
        """
        Initializes a new instance of a constraint
        :param server: Connection the constraint belongs to
        :param parent: Parent object of the constraint. Should be Table
        :param name: Name of the constraint
        """

        NodeObject.__init__(self, server, parent, name)
        ScriptableCreate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)

        # Declare constraint-specific basic properties
        self._convalidated = None
Exemple #13
0
    def __init__(self, server: 's.Server', parent: NodeObject, name: str):
        """
        Initializes a new instance of an Index
        :param server: Server that owns the index
        :param parent: Parent object of the index. Should be Table/View
        :param name: Name of the index
        """
        NodeObject.__init__(self, server, parent, name)
        ScriptableCreate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)

        # Object Properties
        self._is_clustered: Optional[bool] = None
        self._is_primary: Optional[bool] = None
        self._is_unique: Optional[bool] = None
        self._is_valid: Optional[bool] = None
        self._is_concurrent: Optional[bool] = None
Exemple #14
0
    def __init__(self, server: 's.Server', parent: NodeObject, name: str):
        self._server = server
        self._parent: Optional['NodeObject'] = parent
        self._name: str = name
        self._oid: Optional[int] = None
        self._is_system: bool = False

        self._child_collections: Dict[str, NodeCollection] = {}
        self._property_collections: List[NodeLazyPropertyCollection] = []
        # Use _column_property_generator instead of _property_generator
        self._full_properties: NodeLazyPropertyCollection = self._register_property_collection(
            self._sequence_property_generator)

        ScriptableCreate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableDelete.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        ScriptableUpdate.__init__(self, self._template_root(server),
                                  self._macro_root(), server.version)
        self._schema: str = None
        self._scid: int = None
        self._def: dict = None
Exemple #15
0
 def __init__(self):
     ScriptableUpdate.__init__(self, TEMPLATE_ROOT, MACRO_ROOT,
                               SERVER_VERSION)