Giter VIP home page Giter VIP logo

Comments (1)

dosubot avatar dosubot commented on June 3, 2024 2

🤖

Hello again @tatiana! It's great to see you contributing to the Cosmos project once more. Your insights are always appreciated!

Thank you for bringing this issue to our attention. It seems like the error is occurring because the _should_include_node method in the selector.py file is trying to access a node that doesn't exist in the nodes dictionary. This happens when a dbt test doesn't have any node dependencies.

Here's a potential solution to this problem:

def _should_include_node(self, node_id: str, node: DbtNode) -> bool:
    "Checks if a single node should be included. Only runs once per node with caching."
    if node_id in self.visited_nodes:
        return node_id in self.selected_nodes

    self.visited_nodes.add(node_id)

    if node.resource_type == DbtResourceType.TEST and node.depends_on:
        node.tags = getattr(self.nodes.get(node.depends_on[0]), "tags", [])

    if not self._is_tags_subset(node):
        return False

    node_config = {key: value for key, value in node.config.items() if key in SUPPORTED_CONFIG}

    if not self._is_config_subset(node_config):
        return False

    config_copy = copy.deepcopy(self.config.config)
    config_copy.pop("tags", None)
    node_config.pop("tags", None)

    if not (config_copy.items() <= node_config.items()):
        return False

    if self.config.paths and not self._is_path_matching(node):
        return False

    return True

In this modification, we added a check to see if node.depends_on is not empty before trying to access its first element. This should prevent the "IndexError: list index out of range" error from occurring when a dbt test doesn't have any node dependencies.

Please try this solution and let us know if it resolves the issue. If you have any further questions or need additional assistance, feel free to ask.

For more information about the _should_include_node method, you can refer to the cosmos/dbt/selector.py file in the Cosmos repository.

Best regards,
Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

from astronomer-cosmos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.