ariga / atlas-provider-sqlalchemy

Apache License 2.0
9 stars 2 forks source link

Error when using table inheritance #17

Open nitoygo opened 3 days ago

nitoygo commented 3 days ago

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 commented 20 hours ago

@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))