I have these 2 models:
class Server(Base):
__tablename__ = 'Server'
serverName = Column(String(50, 'SQL_Latin1_General_CP1_CI_AS'),
primary_key=True)
serverTypeEnumID = Column(Integer)
serverComponentEnumID = Column(ForeignKey('Enumeration.enumID'))
serverEnvironmentEnumID = Column(ForeignKey('Enumeration.enumID'),
nullable=False)
serverLifecycleEnumID = Column(ForeignKey('Enumeration.enumID'))
processorType = Column(String(50, 'SQL_Latin1_General_CP1_CI_AS'))
processorSpeedInGhz = Column(DECIMAL(9, 2))
physicalProcessorCount = Column(Integer)
corePerProcessorCount = Column(Integer)
coreCount = Column(Integer)
logicalProcessorCount = Column(Integer)
memoryInGB = Column(DECIMAL(19, 2))
serverIsVirtual = Column(String(1, 'SQL_Latin1_General_CP1_CI_AS'))
serverEndOfLifeDate = Column(DateTime)
locationCode = Column(ForeignKey('Location.locationCode'))
serverOSProductID = Column(ForeignKey('ProductVersion.productVersionID'))
updatedDate = Column(DateTime, nullable=False,
server_default=text("(getdate())"))
Location = relationship('Location')
Enumeration = relationship('Enumeration',
primaryjoin='Server.serverComponentEnumID == Enumeration.enumID')
Enumeration1 = relationship('Enumeration',
primaryjoin='Server.serverEnvironmentEnumID == Enumeration.enumID')
Enumeration2 = relationship('Enumeration',
primaryjoin='Server.serverLifecycleEnumID == Enumeration.enumID')
ProductVersion = relationship('ProductVersion')
Storage = relationship('Storage', secondary=lambda: ServerStorage.__table__)
class ServerUtilization(Server):
__tablename__ = 'ServerUtilization'
serverName = Column(ForeignKey('Server.serverName'), primary_key=True)
utilizationProfile = Column(String(50,
'SQL_Latin1_General_CP1_CI_AS'), nullable=False)
utilizationCpuPercent = Column(DECIMAL(9, 2))
utilizationMemoryPercent = Column(DECIMAL(9, 2))
utilizationStoragePercent = Column(DECIMAL(9, 2))
updatedDate = Column(DateTime, nullable=False,
server_default=text("(getdate())"))
And I get this message:
/Users/lmartell/Data-Exchange-Consolidation/scripts/venv/lib/python3.8/site-packages/sqlalchemy/orm/mapper.py:1899:
SAWarning: Implicitly combining column Server.updatedDate with column
ServerUtilization.updatedDate under attribute 'updatedDate'. Please
configure one or more attributes for these same-named columns
explicitly.
I read this:
https://docs.sqlalchemy.org/en/13/faq/ormconfiguration.html#i-m-getting-a-warning-or-error-about-implicitly-combining-column-x-under-attribute-y
But it's not clear to me why I am getting the message in this case,
nor how to fix it.