Skip to content

For error: no filed class for Decimal(38,2) when connect to superset  #67

@rogerlzp

Description

@rogerlzp

Probably there is an error in sqlalchemy-clickhouse 0.1.5.post0.

In my env, following libraries needed have been installed:
infi.clickhouse-orm 1.0.4
sqlalchemy-clickhouse 0.1.5.post0

Howeven, it still complains:"no filed class for Decimal(38,2), when connect to superset,.

From the message, it looks like Deciaml is not supported.

There are four lines to process Decimal type in connector.py:

# db_type for Deimal comes like 'Decimal(P, S) string where P is precision and S is scale'
if db_type.startswith('Decimal'):
    nums = [int(n) for n in db_type[8:-1].split(',')]
    return orm_fields.DecimalField(nums[0], nums[1])

It should work from the code fragment, right?

Now, we have to check connector.py installed in the env.
For my env, the path is /app/py36_venv/lib/python3.6/site-packages/sqlalchemy_clickhouse/connector.py

The four lines never come.
So let's add the four lines to connector.py, and rerun superset.
It works this time!

So there must be something wrong with the publish library,
we have to correct it manually or have to rebuild our own publish library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions