Skip to content

Commit

Permalink
fix(sql): fix sql compilation after making InMemoryTable a subclass…
Browse files Browse the repository at this point in the history
… of `PhysicalTable`
  • Loading branch information
cpcloud committed Sep 12, 2022
1 parent ee9f1be commit aac9524
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ibis/backends/base/sql/compiler/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def _format_in_memory_table(self, op):
f"{val!r} AS {self._quote_identifier(name)}"
for val, name in zip(row, names)
)
for row in op.data.itertuples(index=False)
for row in op.data.to_frame().itertuples(index=False)
)
rows = ", ".join(f"({raw_row})" for raw_row in raw_rows)
return f"(VALUES {rows})"
Expand All @@ -122,15 +122,15 @@ def _format_table(self, expr):
ref_expr = op.table
ref_op = ref_expr.op()

if isinstance(ref_op, ops.PhysicalTable):
if isinstance(ref_op, ops.InMemoryTable):
result = self._format_in_memory_table(ref_op)
is_subquery = True
elif isinstance(ref_op, ops.PhysicalTable):
name = ref_op.name
if name is None:
raise com.RelationError(f'Table did not have a name: {expr!r}')
result = self._quote_identifier(name)
is_subquery = False
elif isinstance(ref_op, ops.InMemoryTable):
result = self._format_in_memory_table(ref_op)
is_subquery = True
else:
# A subquery
if ctx.is_extracted(ref_expr):
Expand Down

0 comments on commit aac9524

Please sign in to comment.