Skip to content

AttributeError: type object 'Temporal' has no attribute 'activity_class' #56

@kootenpv

Description

@kootenpv

I tried both purely the example from the docs, and this example which I would imagine should just work.

Any idea what could be wrong?

import sqlalchemy as sa
import sqlalchemy.orm as orm
import temporal_sqlalchemy as temporal
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base

sessionmaker = orm.sessionmaker()
session = sessionmaker()
temporal.temporal_session(session)

# postgres 11 from docker
connection_string = "postgresql://postgres:[email protected]:5432/test"
engine = create_engine(connection_string, echo=True)

Base = declarative_base()

class MyModel(Base, temporal.TemporalModel):
    __tablename__ = 'my_model_table'
    __table_args__ = {'schema': 'my_schema'}

    id = sa.Column(sa.BigInteger, primary_key=True)
    description = sa.Column(sa.Text)

    class Temporal:
        track = ('description', )

# It crashes here with
# AttributeError: type object 'Temporal' has no attribute 'activity_class'

Base.metadata.create_all(engine)

m = MyModel()
session.add(m)
session.commit()

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