pacificclimate/climate-explorer-backend

Upgrade SQLAlchemy to version 1.3.0 or higher

Closed this issue · 2 comments

Should be self explanatory, but ensure that the pinned version in requirements.txt is greater than version 1.3.0, ensure that it is compatible with the flask-sqlalchemy requirement, ensure that all tests pass and that all functionality is preserved.

q = (
        sesh.query(
            DataFile.unique_id,
            Model.organization,
            Model.short_name,
            Model.long_name,
            Emission.short_name,
            Run.name,
            DataFileVariable.netcdf_variable_name,
            VariableAlias.long_name,
            TimeSet.time_resolution,
            TimeSet.multi_year_mean,
            TimeSet.start_date,
            TimeSet.end_date,
            DataFile.index_time,
        )
        .join(Run, Run.model_id == Model.id)
        .join(Model)
        .join(Emission)
        .join(DataFileVariable, DataFileVariable.variable_alias_id == VariableAlias.id)
        .join(EnsembleDataFileVariables)
        .join(Ensemble)
        .join(VariableAlias)
        .join(TimeSet, TimeSet.id == DataFile.time_set_id)
        .filter(Ensemble.name == ensemble_name)
    )

I edited some joins in ce/api/multimeta.py to resolve ambiguous JOIN issues, but I'm getting an sqlite3.OperationalError: ambiguous column name: models.model_organization
error when running test_multimeta.py. I don't get why this is happening since model_organization is only in models. I tried importing from modelmeta.v2 rather than from modelmeta, but that didn't work.

I may have figured it out. I'm getting a selection FROM models JOIN runs JOIN models.