your sample code puts the classes in _decl_class_registry fine, below is your code with the classes being retrieved:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Integer, Column
BASE = declarative_base()
class NewClass(BASE):
__tablename__ = 'test'
id = Column('id', Integer, primary_key=True)
input_params = {'__tablename__': 'test1',
'id': Column('id', Integer, primary_key=True)}
_ = type('InputClass', (BASE,), input_params)
model_params = {'__tablename__': 'test2',
'id': Column('id', Integer, primary_key=True)}
_ = type('ModelClass', (BASE,), model_params)
predict_params = {'__tablename__': 'test3',
'id': Column('id', Integer, primary_key=True)}
_ = type('PredictClass', (BASE,), predict_params)
input_class = BASE._decl_class_registry["InputClass"]
model_class = BASE._decl_class_registry["ModelClass"]
predict_class = BASE._decl_class_registry["PredictClass"]
from sqlalchemy.orm import Session
print(Session().query(predict_class))
I don't have the resources to go looking at your full application but the basic idea works, if you need help with your app see if you can find folks on the IRC channel to take a look for you, or otherwise try to reverse your code back to the sample above to see what's different.
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Integer, Column
BASE = declarative_base()
class NewClass(BASE):
__tablename__ = 'test'
id = Column('id', Integer, primary_key=True)
input_params = {'__tablename__': 'test1',
'id': Column('id', Integer, primary_key=True)}
_ = type('InputClass', (BASE,), input_params)
model_params = {'__tablename__': 'test2',
'id': Column('id', Integer, primary_key=True)}
_ = type('ModelClass', (BASE,), model_params)
predict_params = {'__tablename__': 'test3',
'id': Column('id', Integer, primary_key=True)}
_ = type('PredictClass', (BASE,), predict_params)
input_class = BASE._decl_class_registry["InputClass"]
model_class = BASE._decl_class_registry["ModelClass"]
predict_class = BASE._decl_class_registry["PredictClass"]
from sqlalchemy.orm import Session
print(Session().query(predict_class))
I don't have the resources to go looking at your full application but the basic idea works, if you need help with your app see if you can find folks on the IRC channel to take a look for you, or otherwise try to reverse your code back to the sample above to see what's different.