Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImproperlyConfigured: Could not build relationship between Transaction and User. #101

Closed
iartarisi opened this issue Aug 7, 2015 · 2 comments

Comments

@iartarisi
Copy link

I'm just trying to get started using the sample code provided, but I'm getting this traceback:

$ python hello.py 
Traceback (most recent call last):
  File "hello.py", line 20, in <module>
    sa.orm.configure_mappers()
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy/orm/mapper.py", line 2736, in configure_mappers
    Mapper.dispatch._for_class(Mapper).after_configured()
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy/event/attr.py", line 218, in __call__
    fn(*args, **kw)
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy/orm/events.py", line 550, in wrap
    fn(*arg, **kw)
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy_continuum/builder.py", line 159, in configure_versioned_classes
    self.build_transaction_class()
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy_continuum/builder.py", line 139, in build_transaction_class
    self.manager.create_transaction_model()
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy_continuum/manager.py", line 155, in create_transaction_model
    self.transaction_cls = self.transaction_cls(self)
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy_continuum/factory.py", line 11, in __call__
    return self.create_class(manager)
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy_continuum/transaction.py", line 117, in create_class
    TransactionBase
  File "/home/mapleoin/sandbox/continuum/venv/lib/python2.7/site-packages/sqlalchemy_continuum/transaction.py", line 144, in Transaction
    'relationship ' % (user_cls, user_cls)
sqlalchemy_continuum.exc.ImproperlyConfigured: Could not build relationship between Transaction and User. User was not found in declarative class registry. Either configure VersioningManager to use different user class or disable this relationship 
# hello.py 
import sqlalchemy as sa
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_continuum import make_versioned

Base = declarative_base()

make_versioned()


class Article(Base):
    __versioned__ = {}
    __tablename__ = 'article'

    id = sa.Column(sa.Integer, primary_key=True, autoincrement=True)
    name = sa.Column(sa.Unicode(255))
    content = sa.Column(sa.UnicodeText)


# after you have defined all your models, call configure_mappers:
sa.orm.configure_mappers()
$ pip freeze
psycopg2==2.6.1
six==1.9.0
SQLAlchemy==1.0.8
SQLAlchemy-Continuum==1.2.0
SQLAlchemy-Utils==0.30.16
@zlhgo
Copy link

zlhgo commented Aug 21, 2015

make_versioned(user_cls=None)

tsantanaDH added a commit to tsantanaDH/sqlalchemy-continuum that referenced this issue Mar 5, 2018
As stated on kvesteri#101, quickstart example doesn't work as is. I've adapted the snippet to let it work without problem if someone copy and paste it.
tsantanaDH added a commit to tsantanaDH/sqlalchemy-continuum that referenced this issue Mar 5, 2018
As stated on kvesteri#101, quickstart example doesn't work as is. I've adapted the snippet to let it work without problem if someone copy and paste it.
@AbdealiLoKo
Copy link
Contributor

AbdealiLoKo commented Aug 30, 2022

@marksteward Similiar to #146
This issue can be closed - the documentation was fixed a few years ago

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants