Open henhuy opened 4 years ago
This is my code:
import saio
from oem2orm.oep_oedialect_oem2orm import setup_db_connection
engine, meta = setup_db_connection()
saio.register_schema("model_draft", engine)
from saio.model_draft import Base
from saio.model_draft import oed_scenario, oed_scalar
Isn't this fixed with PR #37?
Not fixed by #37 the same error persists.
I'm trying to use saio for autodetecting sqlalchemy models via oedialect. I already stumbled upon #35 -but could fix it by setting SQLalchemy to 1.3.14 as suggested in the answer. Unfortunately, i got
KeyError: 'column_names'
in function_reflect_unique_constraints
fromsqlalchemy.engine.reflection
module. It might come from different definitions of the unique constraints in oedialect and sqlalchemy? The thing is, that I never set a unique constraint, but my foreign key is handled returned when callingget_unique_constraints
:{'name': 'oed_data_scenario_id_fkey', 'constrained_columns': ['scenario_id'], 'referred_schema': 'model_draft', 'referred_table': 'oed_scenario', 'referred_columns': ['id'], 'options': {'onupdate': None, 'ondelete': None, 'deferrable': None, 'initially': None, 'match': None}}
So either, there should be any unique constraint at all, or the unqiue constraint return data has to be fixed in order to work with reflect module of sqlalchemy... What do you think, @MGlauer ?