Context:
My team are using Clickhouse, and integrate sql-mock into it.
Problem:
While we are able to support most column types, I am currently writing a custom object to handle StringArrays.
class StringArray(col.ClickhouseColumnMock):
dtype = "Array(String)"
def to_sql(self, column_name: str, value=NO_INPUT) -> str:
# Note: Compare against NO_INPUT instead of checking for None since None could be a valid input for nullable columns
val = value if not isinstance(value, NoInput) else self.default
# In case the val is None, we convert it to NULL
if val is None:
return f"cast(NULL AS {self.dtype}) AS {column_name}"
return f"cast({val} AS {self.dtype}) AS {column_name}"
Proposal:
Would it be possible to write this directly into the sql-mock object, similar to how I can call col.String or col.Decimal. Would be great if I could call col.StringArray
Context: My team are using Clickhouse, and integrate sql-mock into it.
Problem: While we are able to support most column types, I am currently writing a custom object to handle StringArrays.
Proposal: Would it be possible to write this directly into the sql-mock object, similar to how I can call
col.String
orcol.Decimal
. Would be great if I could callcol.StringArray