I am trying to create partition on sql using sqlalchemy. I am using the declarative system. So as we have the following code in simple sql
CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30)
job_code INT NOT NULL,
store_id INT NOT NULL
)
PARTITION BY RANGE (store_id) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN (11),
PARTITION p2 VALUES LESS THAN (16),
PARTITION p3 VALUES LESS THAN MAXVALUE
);
I am trying to write an equivalent code for my class :
class Employee(Base):
__tablename__ = "employee"
__table_args__ = {'mysql_engine': 'InnoDB'}
emp_id = Column(Integer, nullable=False)
fname = Column(String, nullable=False)
lname = Column(String, nullable=False)
job_code = Column(Integer, nullable=False)
store_id = Column(Integer, nullable=False)
I referred to https://groups.google.com/forum/#!searchin/sqlalchemy/Partition$20by$20oracle%7Csort:date/sqlalchemy/qCQFD2LNyTQ/5WyRUP9oBwAJ , but sort of wrote something similer for my actual class below:
class VeryRandom(Base):
__tablename__ = "lil_cool_data"
__table_args__ = {
'info': {
'mysql_partition': """
PARTITION BY RANGE(min)
(PARTITION p1 VALUES LESS THAN (6),
PARTITION p2 VALUES LESS THAN (10),
PARTITION p3 VALUES LESS THAN (20),
PARTITION p4 VALUES LESS THAN (MAXVALUE)
)
"""
}
}
starttime = Column(DateTime, nullable=False)
min = Column(COL_INTEGER, nullable=False, primary_key=True)
random5 = Column(COL_INTEGER, nullable=False)
random4 = Column(Enum('stale', 'fresh'), nullable=False)
random3 = Column(COL_INTEGER, nullable=False)
random2 = Column(COL_INTEGER, nullable=False)
random1 = Column(Boolean, nullable=False, default=False)
But this does not create partion for me. What am i doing wrong ?