Skip to content

SQLAlchemy Error about implicitly combining uid columns #1

Open
@dcrosta

Description

@dcrosta

I'm trying to set up PSA with Flask & SQLAlchemy. I've gotten as far as calling init_social, but as soon as I try to access my app (run flask shell or load a page in flask run, etc), I get this error:

Traceback (most recent call last):
[...]
  File "/Users/dcrosta/src/myproject/myproject/core.py", line 91, in set_up_auth
    init_social(app, db.session)
  File "/Users/dcrosta/.virtualenvs/myproject/lib/python3.6/site-packages/social_flask_sqlalchemy/models.py", line 80, in init_social
    UserSocialAuth.uid = Column(String(UID_LENGTH))
  File "/Users/dcrosta/.virtualenvs/myproject/lib/python3.6/site-packages/sqlalchemy/ext/declarative/api.py", line 69, in __setattr__
    _add_attribute(cls, key, value)
  File "/Users/dcrosta/.virtualenvs/myproject/lib/python3.6/site-packages/sqlalchemy/ext/declarative/base.py", line 658, in _add_attribute
    cls.__mapper__.add_property(key, value)
  File "/Users/dcrosta/.virtualenvs/myproject/lib/python3.6/site-packages/sqlalchemy/orm/mapper.py", line 1854, in add_property
    self._configure_property(key, prop, init=self.configured)
  File "/Users/dcrosta/.virtualenvs/myproject/lib/python3.6/site-packages/sqlalchemy/orm/mapper.py", line 1638, in _configure_property
    prop = self._property_from_column(key, prop)
  File "/Users/dcrosta/.virtualenvs/myproject/lib/python3.6/site-packages/sqlalchemy/orm/mapper.py", line 1768, in _property_from_column
    raise sa_exc.InvalidRequestError(msg)
sqlalchemy.exc.InvalidRequestError: Implicitly combining column social_auth_usersocialauth.uid with column social_auth_usersocialauth.uid under attribute 'uid'.  Please configure one or more attributes for these same-named columns explicitly.

I'm using:

$ pip list | egrep -i "social|flask|sqlalchemy"
Flask                            1.0.2
Flask-Login                      0.4.1
Flask-SQLAlchemy                 2.3.2
python-social-auth               0.3.6
social-auth-app-flask            1.0.0
social-auth-app-flask-sqlalchemy 1.0.1
social-auth-core                 1.7.0
social-auth-storage-sqlalchemy   1.1.0
SQLAlchemy                       1.2.8

As near as I can tell, there's only one actual definition of uid, which is at https://github.com/python-social-auth/social-app-flask-sqlalchemy/blob/master/social_flask_sqlalchemy/models.py#L80 -- everywhere else in the class hierarchy, uid is assigned to None. But I'm hoping that there's something obvious I've missed here, or something you've run into before that can help.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions