diff --git a/ibis/backends/sql/datatypes.py b/ibis/backends/sql/datatypes.py index c4d3317a2970..d955a853d7b3 100644 --- a/ibis/backends/sql/datatypes.py +++ b/ibis/backends/sql/datatypes.py @@ -199,6 +199,9 @@ def from_string(cls, text: str, nullable: bool | None = None) -> dt.DataType: if dtype := cls.unknown_type_strings.get(text.lower()): return dtype + if nullable is None: + nullable = cls.default_nullable + try: sgtype = sg.parse_one(text, into=sge.DataType, read=cls.dialect) except sg.errors.ParseError: @@ -501,7 +504,9 @@ def from_string(cls, text: str, nullable: bool | None = None) -> dt.DataType: if text.lower().startswith("vector"): text = "vector" - return super().from_string(text, nullable=nullable) + return super().from_string( + text, nullable=nullable if nullable is not None else cls.default_nullable + ) class RisingWaveType(PostgresType): @@ -752,7 +757,7 @@ def _from_sqlglot_DECIMAL( if scale is None or int(scale.this.this) == 0: return dt.Int64(nullable=nullable) else: - return super()._from_sqlglot_DECIMAL(precision, scale) + return super()._from_sqlglot_DECIMAL(precision, scale, nullable=nullable) @classmethod def _from_sqlglot_ARRAY(