Skip to content

[CT-2965] fqn selection crashes for external versioned nodes #8374

Closed
@MichelleArk

Description

with a versioned node provided to plugin_manager.get_nodes,

dbt ls --select +dim_customers2
14:11:31  Running with dbt=1.7.0-a1
14:11:31  target not specified in profile 'postgres', using 'default'
14:11:31  Registered adapter: postgres=1.7.0-a1
14:11:31  Found 4 models, 0 sources, 0 exposures, 0 metrics, 352 macros, 0 groups, 0 semantic models
14:11:31  Encountered an error:
list index out of range
14:11:31  Traceback (most recent call last):
  File "/Users/michelleark/src/dbt-core/core/dbt/cli/requires.py", line 87, in wrapper
    result, success = func(*args, **kwargs)
  File "/Users/michelleark/src/dbt-core/core/dbt/cli/requires.py", line 72, in wrapper
    return func(*args, **kwargs)
  File "/Users/michelleark/src/dbt-core/core/dbt/cli/requires.py", line 143, in wrapper
    return func(*args, **kwargs)
  File "/Users/michelleark/src/dbt-core/core/dbt/cli/requires.py", line 172, in wrapper
    return func(*args, **kwargs)
  File "/Users/michelleark/src/dbt-core/core/dbt/cli/requires.py", line 219, in wrapper
    return func(*args, **kwargs)
  File "/Users/michelleark/src/dbt-core/core/dbt/cli/requires.py", line 259, in wrapper
    return func(*args, **kwargs)
  File "/Users/michelleark/src/dbt-core/core/dbt/cli/main.py", line 507, in list
    results = task.run()
  File "/Users/michelleark/src/dbt-core/core/dbt/task/list.py", line 139, in run
    return self.output_results(generator())
  File "/Users/michelleark/src/dbt-core/core/dbt/task/list.py", line 143, in output_results
    for result in results:
  File "/Users/michelleark/src/dbt-core/core/dbt/task/list.py", line 83, in generate_selectors
    for node in self._iterate_selected_nodes():
  File "/Users/michelleark/src/dbt-core/core/dbt/task/list.py", line 61, in _iterate_selected_nodes
    nodes = sorted(selector.get_selected(spec))
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 303, in get_selected
    selected_nodes, indirect_only = self.select_nodes(spec)
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 158, in select_nodes
    direct_nodes, indirect_nodes = self.select_nodes_recursively(spec)
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 130, in select_nodes_recursively
    bundles = [self.select_nodes_recursively(component) for component in spec]
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 130, in <listcomp>
    bundles = [self.select_nodes_recursively(component) for component in spec]
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 130, in select_nodes_recursively
    bundles = [self.select_nodes_recursively(component) for component in spec]
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 130, in <listcomp>
    bundles = [self.select_nodes_recursively(component) for component in spec]
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 130, in select_nodes_recursively
    bundles = [self.select_nodes_recursively(component) for component in spec]
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 130, in <listcomp>
    bundles = [self.select_nodes_recursively(component) for component in spec]
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 128, in select_nodes_recursively
    direct_nodes, indirect_nodes = self.get_nodes_from_criteria(spec)
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 82, in get_nodes_from_criteria
    collected = self.select_included(nodes, spec)
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector.py", line 68, in select_included
    return set(method.search(included_nodes, spec.value))
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector_methods.py", line 215, in search
    if self.node_is_match(selector, real_node.fqn, real_node.is_versioned):
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector_methods.py", line 203, in node_is_match
    elif is_selected_node(unscoped_fqn, qualified_name, is_versioned):
  File "/Users/michelleark/src/dbt-core/core/dbt/graph/selector_methods.py", line 62, in is_selected_node
    if fqn[-2] == node_selector:
IndexError: list index out of range

root cause: versioned model fqn should always contain 3 elements (including the version)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions