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

Error when using table inheritance #17

Open
nitoygo opened this issue Jun 28, 2024 · 1 comment
Open

Error when using table inheritance #17

nitoygo opened this issue Jun 28, 2024 · 1 comment

Comments

@nitoygo
Copy link

nitoygo commented Jun 28, 2024

Using the standalone mode as described in https://atlasgo.io/guides/orms/sqlalchemy
I encounter error pointing to a line in my declarative models that inherits from another model.

@ronenlu
Copy link
Member

ronenlu commented Jul 1, 2024

@nitoygo can you give examples of the models you are using?
I have try to reproduced the issue using the next models, and it works ok.

from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()


class Employee(Base):
    __tablename__ = 'employee'
    id = Column(Integer, primary_key=True)
    name = Column(String(50))
    type = Column(String(50))


class Manager(Employee):
    __tablename__ = 'manager'
    id = Column(Integer, ForeignKey('employee.id'), primary_key=True)
    department = Column(String(50))


class Engineer(Employee):
    __tablename__ = 'engineer'
    id = Column(Integer, ForeignKey('employee.id'), primary_key=True)
    skill_set = Column(String(50))

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

2 participants