clickhouse-sqlalchemy icon indicating copy to clipboard operation
clickhouse-sqlalchemy copied to clipboard

Does support json field ORM?

Open flyly0755 opened this issue 2 years ago • 1 comments

Describe the bug I want to add one json filed with table, store data like this {"a":1."b":2}, but with clickhouse-sqlalchemy ORM, raise error (in table 'tb_file', column 'count'): Compiler <clickhouse_sqlalchemy.drivers.compilers.typecompiler.ClickHouseTypeCompiler object at 0x7f9af09572b0> can't render element of type JSON

To Reproduce

from sqlalchemy import JSON
class TbFile(ChBase, CommonFields):
    __tablename__ = 'tb_file'
    __table_args__ = {'comment': 'File Info Table V1.0'}
    created = Column(types.DateTime, server_default=F.now())
    filename = Column(types.String, primary_key=True)
    count = Column(JSON, nullable=False, default=[])

Expected behavior support json field ORM

Versions python==3.8.5 clickhouse-sqlalchemy==0.2.0

flyly0755 avatar Sep 13 '22 03:09 flyly0755

Json field is not supported. Feel free to make a PR.

xzkostyan avatar Sep 13 '22 09:09 xzkostyan