Skip to content

[Bug]: Issue when saving to MySQL #3942

@NormanTUD

Description

@NormanTUD

What happened?

I am using from ax.storage.sqa_store.save import save_experiment as save_experiment_to_db to save to a MySQL-db.

I consistently get this error message:

(pymysql.err.OperationalError) (1118, 'Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs')
[SQL: 
CREATE TABLE parameter_v2 (
        domain_type SMALLINT NOT NULL, 
        experiment_id INTEGER, 
        id INTEGER NOT NULL AUTO_INCREMENT, 
        generator_run_id INTEGER, 
        name VARCHAR(100) NOT NULL, 
        parameter_type SMALLINT NOT NULL, 
        is_fidelity BOOL, 
        target_value VARCHAR(4096), 
        digits INTEGER, 
        log_scale BOOL, 
        lower FLOAT, 
        upper FLOAT, 
        choice_values VARCHAR(4096), 
        is_ordered BOOL, 
        is_task BOOL, 
        dependents VARCHAR(4096), 
        fixed_value VARCHAR(4096), 
        PRIMARY KEY (id), 
        FOREIGN KEY(experiment_id) REFERENCES experiment_v2 (id), 
        FOREIGN KEY(generator_run_id) REFERENCES generator_run_v2 (id)
)

]

Changing the line target_value: Column[TParamValue | None] = Column(JSONEncodedObject) to target_value: Column[TParamValue | None] = Column(JSONEncodedObject().with_variant(Text, "mysql")) in storage/sqa_store/sqa_classes.py solved this for me for parameter_v2.

But this should probably done for other values as well, and more tested, also with other storage engines that may have different limitations, and other DB fields.

Would be greatly appreciated if this could be fixed properly.

Please provide a minimal, reproducible example of the unexpected behavior.

--

Please paste any relevant traceback/logs produced by the example provided.

Ax Version

1.0.0

Python Version

3.11.2

Operating System

Debian

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

None

Code of Conduct

  • I agree to follow Ax's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions