SQLAlchemy 文档解释了如何创建分区表。但它没有解释如何创建分区。
所以如果我有这个:
#Skipping create_engine and metadata
Base = declarative_base()
class Measure(Base):
__tablename__ = 'measures'
__table_args__ = {
postgresql_partition_by: 'RANGE (log_date)'
}
city_id = Column(Integer, not_null=True)
log_date = Columne(Date, not_null=True)
peaktemp = Column(Integer)
unitsales = Column(Integer)
class Measure2020(Base):
"""How am I suppposed to declare this ? """
Run Code Online (Sandbox Code Playgroud)
我知道我会做的大部分事情SELECT * FROM measures WHERE logdate between XX and YY。但这似乎很有趣。