Skip to content

Commit 4c8283b

Browse files
committed
fix(datatype): convert from sqlglot VARCHAR(MAX) correctly
1 parent dcc79a8 commit 4c8283b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ibis/backends/sql/datatypes.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,13 @@ def _from_sqlglot_ARRAY(
215215
def _from_sqlglot_VARCHAR(
216216
cls, length: sge.DataTypeParam | None = None, nullable: bool | None = None
217217
) -> dt.String:
218-
return dt.String(
219-
length=int(length.this.this) if length is not None else None,
220-
nullable=nullable,
221-
)
218+
if length is None:
219+
length_value = None
220+
elif length.this.this == "MAX":
221+
length_value = None
222+
else:
223+
length_value = int(length.this.this)
224+
return dt.String(length=length_value, nullable=nullable)
222225

223226
_from_sqlglot_NVARCHAR = _from_sqlglot_NCHAR = _from_sqlglot_CHAR = (
224227
_from_sqlglot_FIXEDSTRING

0 commit comments

Comments
 (0)