dbt-labs/dbt-core · error

TableSet.print_structure with output argument

Error message

TableSet.print_structure with output argument

What it means

dbt-agate's Rust TableSet.print_structure bridge only supports the max_rows kwarg; if an output argument is supplied it panics via unimplemented!(), because writing structure output to a custom file/stream target is not implemented.

Solutions

  1. Call print_structure without the output kwarg (prints to stdout with max_rows only)
  2. Capture stdout externally if output redirection is needed
  3. Implement the output branch in crates/dbt-agate/src/table_set.rs call_method

Example fix

// before
table_set.call_method("print_structure", kwargs!{"output" => Value::from(file)})
// after
table_set.call_method("print_structure", kwargs!{"max_rows" => Value::from(10usize)})
Defensive patterns

Strategy: validation

Validate before calling

if output_kwarg.is_some() { panic!("print_structure output argument is not supported"); }

Prevention

When it happens

Trigger: Calling table_set.print_structure(output=<file or stream>) with any non-None value for the output kwarg.

Common situations: Porting Python agate code that redirected print_structure output to a file or StringIO; capturing structure output for logs or tests.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/db25a92a1df996bb. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-agate/src/table_set.rs:367

            //     Print the keys and row counts of each table in the tableset.
            //
            //     :param max_rows:
            //         The maximum number of rows to display before truncating the data.
            //         Defaults to 20.
            //     :param output:
            //         The output used to print the structure of the :class:`Table`.
            //     :returns:
            //         None
            //     """
            // ```
            "print_structure" => {
                let args_iter = ArgsIter::new("TableSet.print_structure", &[], args);
                let max_rows = args_iter.next_kwarg::<Option<usize>>("max_rows")?;
                let output = args_iter.next_kwarg::<Option<&Value>>("output")?;
                args_iter.finish()?;

                if output.is_some() {
                    unimplemented!("TableSet.print_structure with output argument");
                }
                self.print_structure(max_rows, None);
                Ok(Value::from(()))
            }
            // TODO: TableSet.scatterplot
            // TODO: TableSet.select
            // TODO: TableSet.to_csv
            // TODO: TableSet.to_json
            // TODO: TableSet.where
            // Delegate to the super-class -- MappedSequence
            _ => MappedSequence::call_method(self, state, method, args, listeners),
        }
    }

    fn render(self: &Arc<Self>, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        // TODO: delegate to print_structure()
        MappedSequence::render(self, f)
    }

View on GitHub (pinned to 0267ce9170)