pacificclimate / modelmeta

An ORM representation of the model metadata database
GNU General Public License v3.0
1 stars 0 forks source link

IdentifierError during update to streamflow database #80

Closed corviday closed 5 years ago

corviday commented 5 years ago

The following error occurs when updating a database from version 614911daf883 to version 12f290b63791 using alembic:

sqlalchemy.exc.IdentifierError: Identifier 'data_file_variables_dsg_time_series_x_stations_data_file_variable_dsg_ts_id_id_fkey' exceeds maximum length of 63 characters

Downgrading sqlalchemy to version 1.2.0 from version 1.3.3 fixes this issue. So the probable long-term solution is just to pin sqlalchemy at ~1.2 in requirements.txt.

I was unable to find any explicit mention of adding a chartacter limit to identifiers in the sqlalchemy changelogs, though change 3989 seems like it might be relevant.

jameshiebert commented 5 years ago

Why don't we change the name of this index to be more concise? This is probably running up against Postgres's maximum identifier length. This value is technically is configurable, but why not make this reasonable so that it doesn't require tweaking PG's run time config?

rod-glover commented 5 years ago

As the author of this august and explicit identifier, I must ... agree. What was I thinking?

jameshiebert commented 5 years ago

Great! Have we actually run this migration? If not, fixing it is easy. If we have, things get a bit trickier...

corviday commented 5 years ago

The only place the migration has been run is on various disposable test databases. It hasn't been run on anything real yet.