Skip to content

Commit

Permalink
fix(format): support rendering empty schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
kszucs authored and cpcloud committed Sep 9, 2023
1 parent 258a289 commit f8faada
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ibis/expr/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def render_fields(fields, indent_level=0, limit_items=None):


def render_schema(schema, indent_level=0, limit_items=None):
if not len(schema):
return util.indent("<empty schema>", spaces=indent_level * 2)
if limit_items is None:
limit_items = ibis.options.repr.table_columns
return render(schema, indent_level, limit_items, key_separator="")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
UnboundTable: t
<empty schema>
7 changes: 7 additions & 0 deletions ibis/expr/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ def test_format_projection(alltypes, snapshot):
snapshot.assert_match(result, "repr.txt")


def test_format_table_with_empty_schema(snapshot):
# GH #6837
schema = ibis.table({}, name="t")
result = fmt(schema)
snapshot.assert_match(result, "repr.txt")


def test_table_type_output(snapshot):
foo = ibis.table(
[
Expand Down

0 comments on commit f8faada

Please sign in to comment.