i have model
class social(db.model): __tablename__ = 'social_auth_usersocialauth' id = db.column('id',db.integer, primary_key=true) provider = db.column('provider',db.string(32)) extra_data = db.column('extra_data',db.string()) uid = db.column('uid',db.string(255)) def __init__(self,id=none, provider=none, extra_data=none, uid=none): self.id = id self.provider = provider self.extra_data = extra_data self.uid = uid def __repr__(self): return '<social %r>' % self.uid then here function
test = social.query.filter(social.uid == current_user) and when in on view {{ test }}
i it's query, want result , how can ? here result on view now:
select social_auth_usersocialauth.id social_auth_usersocialauth_id, social_auth_usersocialauth.provider social_auth_usersocialauth_provider, social_auth_usersocialauth.extra_data social_auth_usersocialauth_extra_data, social_auth_usersocialauth.uid social_auth_usersocialauth_uid social_auth_usersocialauth social_auth_usersocialauth.uid = :uid_1
you have 2 problems. let's start error.
in query, compare uid field current user. assuming social user model, query should include
social.query.filter(social.uid == current_user.uid) your other problem how access results of query. methods filter , filter_by return basequery(http://flask-sqlalchemy.pocoo.org/2.1/api/#flask.ext.sqlalchemy.basequery). basequery objects have several methods expose results depending on needs. in case sounds want all(http://flask-sqlalchemy.pocoo.org/2.1/api/#flask.ext.sqlalchemy.basequery.all).
putting get
test = social.query.filter(social.uid == current_user.uid).all() once in template, you'll want iterate on test rather echoing directly.
{% user in test %} {{ user }} {% endfor %} if haven't defined social.__str__, output won't useful, should enough moving in right direction.