code: def checkbox(self, model_view, id_, attr, value):
          
          modelview_to_model = {
              '{}ColumnInlineView'.format(name.capitalize()): source.column_class
              for name, source in ConnectorRegistry.sources.items()
          }
          model = modelview_to_model[model_view]
          col = db.session.query(model).filter_by(id=id_).first()
          checked = value == 'true'
          if col:
              setattr(col, attr, checked)
              if checked:
                  metrics = col.get_metrics().values()
                  col.datasource.add_missing_metrics(metrics)
              db.session.commit()
          return json_success('OK')
docs: endpoint for checking/unchecking any boolean in a sqla model