Exemple #1
0
 def get_columns_in_relation(
     self, relation: BaseRelation
 ) -> List[BaseColumn]:
     """Get a list of the columns in the given Relation."""
     raise NotImplementedException(
         '`get_columns_in_relation` is not implemented for this adapter!'
     )
Exemple #2
0
    def drop_relation(self, relation: BaseRelation) -> None:
        """Drop the given relation.

        *Implementors must call self.cache.drop() to preserve cache state!*
        """
        raise NotImplementedException(
            '`drop_relation` is not implemented for this adapter!')
Exemple #3
0
    def rename_relation(self, from_relation, to_relation):
        """
        Override method instead of calling the macro in adapters.sql
        because renaming views is complicated
        """
        self.cache_renamed(from_relation, to_relation)

        existing_relation_type = from_relation.type

        if existing_relation_type == 'table':

            self.connections.execute(f"ALTER TABLE {from_relation} RENAME TO {to_relation.identifier}")

        elif existing_relation_type == 'view':

            result = self.connections.execute(f"""
                SELECT sql FROM {from_relation.schema}.sqlite_master
                WHERE type = 'view' and name = '{from_relation.identifier}'
                """, fetch=True)

            definition = result[1].rows[0][0]

            self.connections.execute(f"DROP VIEW {from_relation}")

            self.connections.execute(f"DROP VIEW IF EXISTS {to_relation}")

            new_definition = definition.replace(from_relation.identifier, f"{to_relation}", 1)

            self.connections.execute(new_definition)

        else:
            raise NotImplementedException(
                f"I don't know how to rename this type of relation: {from_relation.type}," +
                f" from: {from_relation}, to: {to_relation}")
Exemple #4
0
    def rename_relation(self, from_relation: BaseRelation,
                        to_relation: BaseRelation) -> None:
        """Rename the relation from from_relation to to_relation.

        Implementors must call self.cache.rename() to preserve cache state.
        """
        raise NotImplementedException(
            '`rename_relation` is not implemented for this adapter!')
Exemple #5
0
    def convert_time_type(cls, agate_table: agate.Table, col_idx: int) -> str:
        """Return the type in the database that best maps to the
        agate.TimeDelta type for the given agate table and column index.

        :param agate_table: The table
        :param col_idx: The index into the agate table for the column.
        :return: The name of the type in the database
        """
        raise NotImplementedException(
            '`convert_time_type` is not implemented for this adapter!')
Exemple #6
0
    def expand_column_types(self, goal: BaseRelation,
                            current: BaseRelation) -> None:
        """Expand the current table's types to match the goal table. (passable)

        :param self.Relation goal: A relation that currently exists in the
            database with columns of the desired types.
        :param self.Relation current: A relation that currently exists in the
            database with columns of unspecified types.
        """
        raise NotImplementedException(
            '`expand_target_column_types` is not implemented for this adapter!'
        )
Exemple #7
0
    def list_relations_without_caching(
            self, schema_relation: BaseRelation) -> List[BaseRelation]:
        """List relations in the given schema, bypassing the cache.

        This is used as the underlying behavior to fill the cache.

        :param schema_relation: A relation containing the database and schema
            as appropraite for the underlying data warehouse
        :return: The relations in schema
        :rtype: List[self.Relation]
        """
        raise NotImplementedException(
            '`list_relations_without_caching` is not implemented for this '
            'adapter!')
Exemple #8
0
    def list_relations_without_caching(
        self, information_schema: BaseRelation, schema: str
    ) -> List[BaseRelation]:
        """List relations in the given schema, bypassing the cache.

        This is used as the underlying behavior to fill the cache.

        :param Relation information_schema: The information schema to list
            relations from.
        :param str schema: The name of the schema to list relations from.
        :return: The relations in schema
        :rtype: List[self.Relation]
        """
        raise NotImplementedException(
            '`list_relations_without_caching` is not implemented for this '
            'adapter!'
        )
Exemple #9
0
 def set_args(self, params: Parameters):
     """set_args executes in the parent process for an RPC call"""
     raise NotImplementedException('set_args not implemented')
Exemple #10
0
 def truncate_relation(self, relation: BaseRelation) -> None:
     """Truncate the given relation."""
     raise NotImplementedException(
         '`truncate_relation` is not implemented for this adapter!'
     )
Exemple #11
0
 def drop_schema(self, relation: BaseRelation):
     """Drop the given schema (and everything in it) if it exists."""
     raise NotImplementedException(
         '`drop_schema` is not implemented for this adapter!')
Exemple #12
0
 def is_cancelable(cls) -> bool:
     raise NotImplementedException(
         '`is_cancelable` is not implemented for this adapter!'
     )
Exemple #13
0
 def list_schemas(self, database: str) -> List[str]:
     """Get a list of existing schemas in database"""
     raise NotImplementedException(
         '`list_schemas` is not implemented for this adapter!'
     )
Exemple #14
0
 def create_schema(self, relation: BaseRelation):
     """Create the given schema if it does not exist."""
     raise NotImplementedException(
         '`create_schema` is not implemented for this adapter!')
Exemple #15
0
 def date_function(cls) -> str:
     """Get the date function used by this adapter's database."""
     raise NotImplementedException(
         '`date_function` is not implemented for this adapter!')
Exemple #16
0
 def create_schema(self, database: str, schema: str):
     """Create the given schema if it does not exist."""
     raise NotImplementedException(
         '`create_schema` is not implemented for this adapter!'
     )
Exemple #17
0
 def quote(cls, identifier: str) -> str:
     """Quote the given identifier, as appropriate for the database."""
     raise NotImplementedException(
         '`quote` is not implemented for this adapter!'
     )
 def ephemeral_result(self, node, start_time, timing_info):
     raise NotImplementedException(
         'cannot execute ephemeral nodes remotely!')
 def execute(self, compiled_node, manifest):
     raise NotImplementedException()
Exemple #20
0
 def get_runner_type(self):
     raise NotImplementedException('Not Implemented')
Exemple #21
0
 def get_node_selector(self) -> NodeSelector:
     raise NotImplementedException(
         f'get_node_selector not implemented for task {type(self)}'
     )
Exemple #22
0
 def get_selection_spec(self) -> SelectionSpec:
     raise NotImplementedException(
         f'get_selection_spec not implemented for task {type(self)}'
     )
Exemple #23
0
 def drop_schema(self, database: str, schema: str):
     """Drop the given schema (and everything in it) if it exists."""
     raise NotImplementedException(
         '`drop_schema` is not implemented for this adapter!'
     )
Exemple #24
0
 def build_query(self):
     raise NotImplementedException('Not Implemented')
Exemple #25
0
 def before_execute(self):
     raise NotImplementedException()
Exemple #26
0
 def after_execute(self, result):
     raise NotImplementedException()
Exemple #27
0
 def handle_request(self) -> Result:
     """handle_request executes inside the child process for an RPC call"""
     raise NotImplementedException('handle_request not implemented')
Exemple #28
0
 def execute(self, compiled_node, flat_graph):
     raise NotImplementedException()