You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We found a workaround to fix that.
Define a new data layer class and change Query.all method like that:
class PatchedAll:
def __init__(self, model):
self.model = model
def __get__(self, instance, owner):
self.instance = instance
return self
def __call__(self):
result = self.instance.session.execute(self.instance).fetchall()
return [self.model(**{
k[len(self.model.__tablename__) + 1:]: v for k, v in element.items()
}) for element in result]
class SQLAlchemyDuplicateDataLayer(SqlalchemyDataLayer):
def query(self, view_kwargs):
query = self.session.query(self.model)
type(self.session.query()).all = PatchedAll(self.model)
return query
A clickhouse may have entries with the same primary keys. And the alchemy in this line eliminates duplicates:
flask-combo-jsonapi/flask_combo_jsonapi/data_layers/alchemy.py
Lines 226 to 228 in 17e4a23
For such a case, I think you need to override the all method and use something like
session.execute(query).fetchall()
The text was updated successfully, but these errors were encountered: