Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add new alias field with type Decimal64Field #142

Open
TvoroG opened this issue Mar 25, 2020 · 1 comment
Open

Cannot add new alias field with type Decimal64Field #142

TvoroG opened this issue Mar 25, 2020 · 1 comment
Labels

Comments

@TvoroG
Copy link
Contributor

TvoroG commented Mar 25, 2020

Hi!

After migration I can find the new field with type Decimal64Field, but it is not alias. For example:

# model from tests/test_migrations.py
class AliasModel1(Model):
    date = DateField()
    date_alias = DateField(alias='date')
    int_field = Int8Field()
    int_field_plus_one = Int8Field(alias='int_field + 1')

    # this is new field with alias expression
    dec = Decimal64Field(6, alias='toDecimal64(int_field, 6) / 10')

    engine = MergeTree('date', ('date',))

    @classmethod
    def table_name(cls):
        return 'alias_date'

After migration this model has dec field but it is not alias.

First it creates correctly field here, but then it checks types and compares Decimal64(6) with Decimal(18, 6) and alters it again.

@TvoroG
Copy link
Contributor Author

TvoroG commented Mar 25, 2020

I've tried to change Decimal64Field(6) to DecimalField(18, 6) but it didn't help, because DecimalField has db_type = Decimal(18,6) (no space) and clickhouse returns type Decimal(18, 6)

@ishirav ishirav added the bug label May 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants